blob: 41f2da4f9e2013e900ad68c3df8d64b78cf67417 [file] [log] [blame]
developera999a7c2023-11-23 12:34:06 +08001--- a/crypto/Kconfig
2+++ b/crypto/Kconfig
3@@ -1823,6 +1823,19 @@ config CRYPTO_JITTERENTROPY
4 random numbers. This Jitterentropy RNG registers with
5 the kernel crypto API and can be used by any caller.
6
7+config CRYPTO_CPU_JITTERENTROPY_DEBUG
8+ bool "Jitterentropy DEBUG FS"
9+ default n
10+ select CRYPTO_USER
11+ select CRYPTO_JITTERENTROPY
12+ select CRYPTO_USER_API_RNG
13+ help
14+ Enable the DebugFS interface of the CPU Jitter
15+ random number generator. It is solely intended
16+ to aid testing and for performing statistical
17+ and entropy analyses. You should say no
18+ unless you know what you are doing.
19+
20 config CRYPTO_USER_API
21 tristate
22
23@@ -1853,6 +1868,17 @@ config CRYPTO_USER_API_RNG
24 This option enables the user-spaces interface for random
25 number generator algorithms.
26
27+config CRYPTO_USER_API_RNG_CAVP
28+ bool "Enable CAVP testing of DRBG"
29+ select CRYPTO_USER_API_HASH
30+ select CRYPTO_DRBG
31+ default n
32+ help
33+ This option enables extra API for CAVP testing via the user-space
34+ interface: resetting of DRBG entropy, and providing Additional Data.
35+ This should only be enabled for CAVP testing. You should say
36+ no unless you know what this is.
37+
38 config CRYPTO_USER_API_AEAD
39 tristate "User-space interface for AEAD cipher algorithms"
40 depends on NET
41@@ -1879,6 +1904,16 @@ config CRYPTO_STATS
42 config CRYPTO_HASH_INFO
43 bool
44
45+config CRYPTO_CAVP_TEST
46+ bool "Enable CAVP testing of DRBG and JITTERRNG"
47+ select CRYPTO_DRBG
48+ select CRYPTO_DRBG_MENU
49+ select CRYPTO_CPU_JITTERENTROPY_DEBUG
50+ select CRYPTO_USER_API_RNG_CAVP
51+ default n
52+ help
53+ This option enables DRBG CAVP test and JITTERENG CMVP test
54+
55 source "lib/crypto/Kconfig"
56 source "drivers/crypto/Kconfig"
57 source "crypto/asymmetric_keys/Kconfig"
58
59--- a/crypto/algif_rng.c
60+++ b/crypto/algif_rng.c
61@@ -51,7 +51,7 @@ MODULE_AUTHOR("Stephan Mueller <smueller
62 MODULE_DESCRIPTION("User-space interface for random number generators");
63
64 struct rng_ctx {
65-#define MAXSIZE 128
66+#define MAXSIZE 256
67 unsigned int len;
68 struct crypto_rng *drng;
69 u8 *addtl;