FIPS 140-2 section 4.9.2 requires a continuous self test of the noise source. Up to kernel 4.8 drivers/char/random.c provided this continuous self test. Afterwards it was moved to a location that is inconsistent with the FIPS 140-2 requirements. The relevant patch was e192be9d9a30555aae2ca1dc3aad37cba484cd4a . Thus, the FIPS 140-2 CTRNG is added to the DRBG when it obtains the seed. This patch resurrects the function drbg_fips_continous_test that existed some time ago and applies it to the noise sources. The patch that removed the drbg_fips_continous_test was b3614763059b82c26bdd02ffcb1c016c1132aad0 . The Jitter RNG implements its own FIPS 140-2 self test and thus does not need to be subjected to the test in the DRBG. The patch contains a tiny fix to ensure proper zeroization in case of an error during the Jitter RNG data gathering.
Showing the changes to include/crypto (1 of 2 files). Show all
Unified · Split
| @@ -129,6 +129,8 @@ struct drbg_state { · 128 unmodified lines | |||
| 129 | 129 | ||
| 130 | bool seeded; /* DRBG fully seeded? */ | 130 | bool seeded; /* DRBG fully seeded? */ |
| 131 | bool pr; /* Prediction resistance enabled? */ | 131 | bool pr; /* Prediction resistance enabled? */ |
| 132 | bool fips_primed; /* Continuous test primed? */ | ||
| 133 | unsigned char *prev; /* FIPS 140-2 continuous test value */ | ||
| 132 | struct work_struct seed_work; /* asynchronous seeding support */ | 134 | struct work_struct seed_work; /* asynchronous seeding support */ |
| 133 | struct crypto_rng *jent; | 135 | struct crypto_rng *jent; |
| 134 | const struct drbg_state_ops *d_ops; | 136 | const struct drbg_state_ops *d_ops; |