1*b077aed3SPierre Pronchery=pod 2*b077aed3SPierre Pronchery 3*b077aed3SPierre Pronchery=head1 NAME 4*b077aed3SPierre Pronchery 5*b077aed3SPierre ProncheryEVP_RAND-HASH-DRBG - The HASH DRBG EVP_RAND implementation 6*b077aed3SPierre Pronchery 7*b077aed3SPierre Pronchery=head1 DESCRIPTION 8*b077aed3SPierre Pronchery 9*b077aed3SPierre ProncherySupport for the hash deterministic random bit generator through the 10*b077aed3SPierre ProncheryB<EVP_RAND> API. 11*b077aed3SPierre Pronchery 12*b077aed3SPierre Pronchery=head2 Identity 13*b077aed3SPierre Pronchery 14*b077aed3SPierre Pronchery"HASH-DRBG" is the name for this implementation; it can be used with the 15*b077aed3SPierre ProncheryEVP_RAND_fetch() function. 16*b077aed3SPierre Pronchery 17*b077aed3SPierre Pronchery=head2 Supported parameters 18*b077aed3SPierre Pronchery 19*b077aed3SPierre ProncheryThe supported parameters are: 20*b077aed3SPierre Pronchery 21*b077aed3SPierre Pronchery=over 4 22*b077aed3SPierre Pronchery 23*b077aed3SPierre Pronchery=item "state" (B<OSSL_RAND_PARAM_STATE>) <integer> 24*b077aed3SPierre Pronchery 25*b077aed3SPierre Pronchery=item "strength" (B<OSSL_RAND_PARAM_STRENGTH>) <unsigned integer> 26*b077aed3SPierre Pronchery 27*b077aed3SPierre Pronchery=item "max_request" (B<OSSL_RAND_PARAM_MAX_REQUEST>) <unsigned integer> 28*b077aed3SPierre Pronchery 29*b077aed3SPierre Pronchery=item "reseed_requests" (B<OSSL_DRBG_PARAM_RESEED_REQUESTS>) <unsigned integer> 30*b077aed3SPierre Pronchery 31*b077aed3SPierre Pronchery=item "reseed_time_interval" (B<OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL>) <integer> 32*b077aed3SPierre Pronchery 33*b077aed3SPierre Pronchery=item "min_entropylen" (B<OSSL_DRBG_PARAM_MIN_ENTROPYLEN>) <unsigned integer> 34*b077aed3SPierre Pronchery 35*b077aed3SPierre Pronchery=item "max_entropylen" (B<OSSL_DRBG_PARAM_MAX_ENTROPYLEN>) <unsigned integer> 36*b077aed3SPierre Pronchery 37*b077aed3SPierre Pronchery=item "min_noncelen" (B<OSSL_DRBG_PARAM_MIN_NONCELEN>) <unsigned integer> 38*b077aed3SPierre Pronchery 39*b077aed3SPierre Pronchery=item "max_noncelen" (B<OSSL_DRBG_PARAM_MAX_NONCELEN>) <unsigned integer> 40*b077aed3SPierre Pronchery 41*b077aed3SPierre Pronchery=item "max_perslen" (B<OSSL_DRBG_PARAM_MAX_PERSLEN>) <unsigned integer> 42*b077aed3SPierre Pronchery 43*b077aed3SPierre Pronchery=item "max_adinlen" (B<OSSL_DRBG_PARAM_MAX_ADINLEN>) <unsigned integer> 44*b077aed3SPierre Pronchery 45*b077aed3SPierre Pronchery=item "reseed_counter" (B<OSSL_DRBG_PARAM_RESEED_COUNTER>) <unsigned integer> 46*b077aed3SPierre Pronchery 47*b077aed3SPierre Pronchery=item "properties" (B<OSSL_DRBG_PARAM_PROPERTIES>) <UTF8 string> 48*b077aed3SPierre Pronchery 49*b077aed3SPierre Pronchery=item "digest" (B<OSSL_DRBG_PARAM_DIGEST>) <UTF8 string> 50*b077aed3SPierre Pronchery 51*b077aed3SPierre ProncheryThese parameters work as described in L<EVP_RAND(3)/PARAMETERS>. 52*b077aed3SPierre Pronchery 53*b077aed3SPierre Pronchery=back 54*b077aed3SPierre Pronchery 55*b077aed3SPierre Pronchery=head1 NOTES 56*b077aed3SPierre Pronchery 57*b077aed3SPierre ProncheryA context for HASH DRBG can be obtained by calling: 58*b077aed3SPierre Pronchery 59*b077aed3SPierre Pronchery EVP_RAND *rand = EVP_RAND_fetch(NULL, "HASH-DRBG", NULL); 60*b077aed3SPierre Pronchery EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand); 61*b077aed3SPierre Pronchery 62*b077aed3SPierre Pronchery=head1 EXAMPLES 63*b077aed3SPierre Pronchery 64*b077aed3SPierre Pronchery EVP_RAND *rand; 65*b077aed3SPierre Pronchery EVP_RAND_CTX *rctx; 66*b077aed3SPierre Pronchery unsigned char bytes[100]; 67*b077aed3SPierre Pronchery OSSL_PARAM params[2], *p = params; 68*b077aed3SPierre Pronchery unsigned int strength = 128; 69*b077aed3SPierre Pronchery 70*b077aed3SPierre Pronchery rand = EVP_RAND_fetch(NULL, "HASH-DRBG", NULL); 71*b077aed3SPierre Pronchery rctx = EVP_RAND_CTX_new(rand, NULL); 72*b077aed3SPierre Pronchery EVP_RAND_free(rand); 73*b077aed3SPierre Pronchery 74*b077aed3SPierre Pronchery *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha512, 0); 75*b077aed3SPierre Pronchery *p = OSSL_PARAM_construct_end(); 76*b077aed3SPierre Pronchery EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params); 77*b077aed3SPierre Pronchery 78*b077aed3SPierre Pronchery EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0); 79*b077aed3SPierre Pronchery 80*b077aed3SPierre Pronchery EVP_RAND_CTX_free(rctx); 81*b077aed3SPierre Pronchery 82*b077aed3SPierre Pronchery=head1 CONFORMING TO 83*b077aed3SPierre Pronchery 84*b077aed3SPierre ProncheryNIST SP 800-90A and SP 800-90B 85*b077aed3SPierre Pronchery 86*b077aed3SPierre Pronchery=head1 SEE ALSO 87*b077aed3SPierre Pronchery 88*b077aed3SPierre ProncheryL<EVP_RAND(3)>, 89*b077aed3SPierre ProncheryL<EVP_RAND(3)/PARAMETERS> 90*b077aed3SPierre Pronchery 91*b077aed3SPierre Pronchery=head1 COPYRIGHT 92*b077aed3SPierre Pronchery 93*b077aed3SPierre ProncheryCopyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 94*b077aed3SPierre Pronchery 95*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License"). You may not use 96*b077aed3SPierre Proncherythis file except in compliance with the License. You can obtain a copy 97*b077aed3SPierre Proncheryin the file LICENSE in the source distribution or at 98*b077aed3SPierre ProncheryL<https://www.openssl.org/source/license.html>. 99*b077aed3SPierre Pronchery 100*b077aed3SPierre Pronchery=cut 101