]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: drbg - add FIPS 140-2 CTRNG for noise source
authorStephan Mueller <smueller@chronox.de>
Wed, 8 May 2019 14:19:24 +0000 (16:19 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 23 May 2019 06:01:06 +0000 (14:01 +0800)
commit36b849f09e45c9c41191df35fc0a6e3b645fc239
tree7b9edef481bf6ab03778a904078ac6020bfeb237
parent41c671a32b2c6d6e7f6fc8b8da25b8fac58fe402
crypto: drbg - add FIPS 140-2 CTRNG for noise source

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
8ba6b2edcf3c1cf0fb7cda8c3e1163af5b478598 .

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
6567e9e01907b4cc37a4f7ffa6a99c3401adbe6d .

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.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Reviewed-by: Yann Droneaud <ydroneaud@opteya.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/drbg.c
include/crypto/drbg.h