hc
2024-02-20 e636c8d336489bf3eed5878299e6cc045bbad077
kernel/include/crypto/drbg.h
....@@ -105,6 +105,12 @@
105105 struct drbg_string *testentropy; /* TEST PARAMETER: test entropy */
106106 };
107107
108
+enum drbg_seed_state {
109
+ DRBG_SEED_STATE_UNSEEDED,
110
+ DRBG_SEED_STATE_PARTIAL, /* Seeded with !rng_is_initialized() */
111
+ DRBG_SEED_STATE_FULL,
112
+};
113
+
108114 struct drbg_state {
109115 struct mutex drbg_mutex; /* lock around DRBG */
110116 unsigned char *V; /* internal state 10.1.1.1 1a) */
....@@ -127,14 +133,14 @@
127133 struct crypto_wait ctr_wait; /* CTR mode async wait obj */
128134 struct scatterlist sg_in, sg_out; /* CTR mode SGLs */
129135
130
- bool seeded; /* DRBG fully seeded? */
136
+ enum drbg_seed_state seeded; /* DRBG fully seeded? */
131137 bool pr; /* Prediction resistance enabled? */
132
- struct work_struct seed_work; /* asynchronous seeding support */
138
+ bool fips_primed; /* Continuous test primed? */
139
+ unsigned char *prev; /* FIPS 140-2 continuous test value */
133140 struct crypto_rng *jent;
134141 const struct drbg_state_ops *d_ops;
135142 const struct drbg_core *core;
136143 struct drbg_string test_data;
137
- struct random_ready_callback random_ready;
138144 };
139145
140146 static inline __u8 drbg_statelen(struct drbg_state *drbg)
....@@ -182,11 +188,7 @@
182188 static inline size_t drbg_max_requests(struct drbg_state *drbg)
183189 {
184190 /* SP800-90A requires 2**48 maximum requests before reseeding */
185
-#if (__BITS_PER_LONG == 32)
186
- return SIZE_MAX;
187
-#else
188
- return (1UL<<48);
189
-#endif
191
+ return (1<<20);
190192 }
191193
192194 /*