1EVP_RAND-HMAC-DRBG(7ossl) OpenSSL EVP_RAND-HMAC-DRBG(7ossl)
2
3
4
6 EVP_RAND-HMAC-DRBG - The HMAC DRBG EVP_RAND implementation
7
9 Support for the HMAC deterministic random bit generator through the
10 EVP_RAND API.
11
12 Identity
13 "HMAC-DRBG" is the name for this implementation; it can be used with
14 the EVP_RAND_fetch() function.
15
16 Supported parameters
17 The supported parameters are:
18
19 "state" (OSSL_RAND_PARAM_STATE) <integer>
20 "strength" (OSSL_RAND_PARAM_STRENGTH) <unsigned integer>
21 "max_request" (OSSL_RAND_PARAM_MAX_REQUEST) <unsigned integer>
22 "reseed_requests" (OSSL_DRBG_PARAM_RESEED_REQUESTS) <unsigned integer>
23 "reseed_time_interval" (OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) <integer>
24 "min_entropylen" (OSSL_DRBG_PARAM_MIN_ENTROPYLEN) <unsigned integer>
25 "max_entropylen" (OSSL_DRBG_PARAM_MAX_ENTROPYLEN) <unsigned integer>
26 "min_noncelen" (OSSL_DRBG_PARAM_MIN_NONCELEN) <unsigned integer>
27 "max_noncelen" (OSSL_DRBG_PARAM_MAX_NONCELEN) <unsigned integer>
28 "max_perslen" (OSSL_DRBG_PARAM_MAX_PERSLEN) <unsigned integer>
29 "max_adinlen" (OSSL_DRBG_PARAM_MAX_ADINLEN) <unsigned integer>
30 "reseed_counter" (OSSL_DRBG_PARAM_RESEED_COUNTER) <unsigned integer>
31 "properties" (OSSL_DRBG_PARAM_PROPERTIES) <UTF8 string>
32 "mac" (OSSL_DRBG_PARAM_MAC) <UTF8 string>
33 "digest" (OSSL_DRBG_PARAM_DIGEST) <UTF8 string>
34 These parameters work as described in "PARAMETERS" in EVP_RAND(3).
35
37 A context for HMAC DRBG can be obtained by calling:
38
39 EVP_RAND *rand = EVP_RAND_fetch(NULL, "HMAC-DRBG", NULL);
40 EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand);
41
43 EVP_RAND *rand;
44 EVP_RAND_CTX *rctx;
45 unsigned char bytes[100];
46 OSSL_PARAM params[3], *p = params;
47 unsigned int strength = 128;
48
49 rand = EVP_RAND_fetch(NULL, "HMAC-DRBG", NULL);
50 rctx = EVP_RAND_CTX_new(rand, NULL);
51 EVP_RAND_free(rand);
52
53 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_MAC, SN_hmac, 0);
54 *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_DIGEST, SN_sha256, 0);
55 *p = OSSL_PARAM_construct_end();
56 EVP_RAND_instantiate(rctx, strength, 0, NULL, 0, params);
57
58 EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);
59
60 EVP_RAND_CTX_free(rctx);
61
63 NIST SP 800-90A and SP 800-90B
64
66 EVP_RAND(3), "PARAMETERS" in EVP_RAND(3)
67
69 Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
70
71 Licensed under the Apache License 2.0 (the "License"). You may not use
72 this file except in compliance with the License. You can obtain a copy
73 in the file LICENSE in the source distribution or at
74 <https://www.openssl.org/source/license.html>.
75
76
77
783.0.5 2022-07-05 EVP_RAND-HMAC-DRBG(7ossl)