X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=crypto%2Frand%2Frand_lcl.h;fp=crypto%2Frand%2Frand_lcl.h;h=d793d282139ae18a02bd4d81002801939f2e31ef;hp=1b2bd888079fb787afdb3f2f6e526de5933bd393;hb=d69226a3fc8e8448572d175e8d96ff7e817b1ebd;hpb=cd353c7768e7f1dfdfe369be900666241ddedefb diff --git a/crypto/rand/rand_lcl.h b/crypto/rand/rand_lcl.h index 1b2bd88807..d793d28213 100644 --- a/crypto/rand/rand_lcl.h +++ b/crypto/rand/rand_lcl.h @@ -33,7 +33,15 @@ # define MASTER_RESEED_TIME_INTERVAL (60*60) /* 1 hour */ # define SLAVE_RESEED_TIME_INTERVAL (7*60) /* 7 minutes */ - +/* + * The number of bytes that constitutes an atomic lump of entropy with respect + * to the FIPS 140-2 section 4.9.2 Conditional Tests. The size is somewhat + * arbitrary, the smaller the value, the less entropy is consumed on first + * read but the higher the probability of the test failing by accident. + * + * The value is in bytes. + */ +#define CRNGT_BUFSIZ 16 /* * Maximum input size for the DRBG (entropy, nonce, personalization string) @@ -44,7 +52,8 @@ */ # define DRBG_MAX_LENGTH INT32_MAX - +/* The default nonce */ +# define DRBG_DEFAULT_PERS_STRING "OpenSSL NIST SP 800-90A DRBG" /* * Maximum allocation size for RANDOM_POOL buffers @@ -321,4 +330,20 @@ int drbg_ctr_init(RAND_DRBG *drbg); int drbg_hash_init(RAND_DRBG *drbg); int drbg_hmac_init(RAND_DRBG *drbg); +/* + * Entropy call back for the FIPS 140-2 section 4.9.2 Conditional Tests. + * These need to be exposed for the unit tests. + */ +int rand_crngt_get_entropy_cb(unsigned char *buf); +extern int (*crngt_get_entropy)(unsigned char *); +int rand_crngt_init(void); +void rand_crngt_cleanup(void); + +/* + * Expose the run once initialisation function for the unit tests because. + * they need to restart from scratch to validate the first block is skipped + * properly. + */ +int rand_crngt_single_init(void); + #endif