doc: update documenation with params argument on DRBG instantiate calls

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14310)
This commit is contained in:
Pauli 2021-02-26 10:56:46 +10:00
parent 7198bd1a8f
commit f8a5822cff
6 changed files with 9 additions and 7 deletions

View File

@ -81,7 +81,7 @@ A context for CTR DRBG can be obtained by calling:
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
SN_aes_256_ctr, 0);
*p = OSSL_PARAM_construct_end();
EVP_RAND_set_ctx_params(rctx, params);
EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);

View File

@ -73,7 +73,7 @@ A context for HASH DRBG can be obtained by calling:
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha512, 0);
*p = OSSL_PARAM_construct_end();
EVP_RAND_set_ctx_params(rctx, params);
EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);

View File

@ -76,7 +76,7 @@ A context for HMAC DRBG can be obtained by calling:
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, SN_hmac, 0);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha256, 0);
*p = OSSL_PARAM_construct_end();
EVP_RAND_set_ctx_params(rctx, params);
EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);

View File

@ -63,7 +63,7 @@ A context for the seed source can be obtained by calling:
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
SN_aes_256_ctr, 0);
*p = OSSL_PARAM_construct_end();
EVP_RAND_set_ctx_params(rctx, params);
EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);

View File

@ -90,7 +90,7 @@ A context for a test generator can be obtained by calling:
*p++ = OSSL_PARAM_construct_octet_string(OSSL_RAND_PARAM_TEST_NONCE,
nonce, sizeof(nonce));
*p = OSSL_PARAM_construct_end();
EVP_RAND_set_ctx_params(rctx, params);
EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);

View File

@ -26,7 +26,8 @@ functions
/* Random number generator functions: NIST */
int OSSL_FUNC_rand_instantiate(void *ctx, unsigned int strength,
int prediction_resistance,
const unsigned char *pstr, size_t pstr_len);
const unsigned char *pstr, size_t pstr_len,
const OSSL_PARAM params[]);
int OSSL_FUNC_rand_uninstantiate(void *ctx);
int OSSL_FUNC_rand_generate(void *ctx, unsigned char *out, size_t outlen,
unsigned int strength, int prediction_resistance,
@ -97,7 +98,8 @@ These functions correspond to those defined in NIST SP 800-90A and SP 800-90C.
OSSL_FUNC_rand_instantiate() is used to instantiate the DRBG I<ctx> at a requested
security I<strength>. In addition, I<prediction_resistance> can be requested.
Additional input I<addin> of length I<addin_len> bytes can optionally
be provided.
be provided. The parameters specified in I<params> configure the DRBG and these
should be processed before instantiation.
OSSL_FUNC_rand_uninstantiate() is used to uninstantiate the DRBG I<ctx>. After being
uninstantiated, a DRBG is unable to produce output until it is instantiated