OSDN Git Service

crypto: drbg - always seeded with SP800-90B compliant noise source
authorStephan Müller <smueller@chronox.de>
Fri, 17 Apr 2020 19:34:03 +0000 (21:34 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Apr 2020 07:42:17 +0000 (17:42 +1000)
commit97f2650e504033376e8813691cb6eccf73151676
tree5d74704b2aa5db3876a164d4b4207ada303b5ac4
parent764428fe99e82ce9a57ca22fb8adc3370922348d
crypto: drbg - always seeded with SP800-90B compliant noise source

As the Jitter RNG provides an SP800-90B compliant noise source, use this
noise source always for the (re)seeding of the DRBG.

To make sure the DRBG is always properly seeded, the reseed threshold
is reduced to 1<<20 generate operations.

The Jitter RNG may report health test failures. Such health test
failures are treated as transient as follows. The DRBG will not reseed
from the Jitter RNG (but from get_random_bytes) in case of a health
test failure. Though, it produces the requested random number.

The Jitter RNG has a failure counter where at most 1024 consecutive
resets due to a health test failure are considered as a transient error.
If more consecutive resets are required, the Jitter RNG will return
a permanent error which is returned to the caller by the DRBG. With this
approach, the worst case reseed threshold is significantly lower than
mandated by SP800-90A in order to seed with an SP800-90B noise source:
the DRBG has a reseed threshold of 2^20 * 1024 = 2^30 generate requests.

Yet, in case of a transient Jitter RNG health test failure, the DRBG is
seeded with the data obtained from get_random_bytes.

However, if the Jitter RNG fails during the initial seeding operation
even due to a health test error, the DRBG will send an error to the
caller because at that time, the DRBG has received no seed that is
SP800-90B compliant.

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