| .. | .. |
|---|
| 105 | 105 | struct drbg_string *testentropy; /* TEST PARAMETER: test entropy */ |
|---|
| 106 | 106 | }; |
|---|
| 107 | 107 | |
|---|
| 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 | + |
|---|
| 108 | 114 | struct drbg_state { |
|---|
| 109 | 115 | struct mutex drbg_mutex; /* lock around DRBG */ |
|---|
| 110 | 116 | unsigned char *V; /* internal state 10.1.1.1 1a) */ |
|---|
| .. | .. |
|---|
| 127 | 133 | struct crypto_wait ctr_wait; /* CTR mode async wait obj */ |
|---|
| 128 | 134 | struct scatterlist sg_in, sg_out; /* CTR mode SGLs */ |
|---|
| 129 | 135 | |
|---|
| 130 | | - bool seeded; /* DRBG fully seeded? */ |
|---|
| 136 | + enum drbg_seed_state seeded; /* DRBG fully seeded? */ |
|---|
| 131 | 137 | 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 */ |
|---|
| 133 | 140 | struct crypto_rng *jent; |
|---|
| 134 | 141 | const struct drbg_state_ops *d_ops; |
|---|
| 135 | 142 | const struct drbg_core *core; |
|---|
| 136 | 143 | struct drbg_string test_data; |
|---|
| 137 | | - struct random_ready_callback random_ready; |
|---|
| 138 | 144 | }; |
|---|
| 139 | 145 | |
|---|
| 140 | 146 | static inline __u8 drbg_statelen(struct drbg_state *drbg) |
|---|
| .. | .. |
|---|
| 182 | 188 | static inline size_t drbg_max_requests(struct drbg_state *drbg) |
|---|
| 183 | 189 | { |
|---|
| 184 | 190 | /* 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); |
|---|
| 190 | 192 | } |
|---|
| 191 | 193 | |
|---|
| 192 | 194 | /* |
|---|