crypto: jitter - SP800-90B compliance
authorStephan Müller <smueller@chronox.de>
Fri, 17 Apr 2020 19:33:33 +0000 (21:33 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 24 Apr 2020 07:42:17 +0000 (17:42 +1000)
commit764428fe99e82ce9a57ca22fb8adc3370922348d
treef9addb875204120d19674575e23fc7c6bf0dfb59
parent63e05f3275172283fd0020dba678ef8eca869ef7
crypto: jitter - SP800-90B compliance

SP800-90B specifies various requirements for the noise source(s) that
may seed any DRNG including SP800-90A DRBGs. In November 2020,
SP800-90B will be mandated for all noise sources that provide entropy
to DRBGs as part of a FIPS 140-[2|3] validation or other evaluation
types. Without SP800-90B compliance, a noise source is defined to always
deliver zero bits of entropy.

This patch ports the SP800-90B compliance from the user space Jitter RNG
version 2.2.0.

The following changes are applied:

- addition of (an enhanced version of) the repetitive count test (RCT)
  from SP800-90B section 4.4.1 - the enhancement is due to the fact of
  using the stuck test as input to the RCT.

- addition of the adaptive proportion test (APT) from SP800-90B section
  4.4.2

- update of the power-on self test to perform a test measurement of 1024
  noise samples compliant to SP800-90B section 4.3

- remove of the continuous random number generator test which is
  replaced by APT and RCT

Health test failures due to the SP800-90B operation are only enforced in
FIPS mode. If a runtime health test failure is detected, the Jitter RNG
is reset. If more than 1024 resets in a row are performed, a permanent
error is returned to the caller.

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