EVP_RAND-HMAC-DRBG(7ossl)
okay so welcome to the EVP_RAND-HMAC-DRBG(7ossl) page, bestie π we're talking about the HMAC DRBG EVP_RAND implementation, and it's lowkey iconic. No cap, this one's got FIPS notes, parameters, and code.
π NAME π
EVP_RAND-HMAC-DRBG β the HMAC DRBG EVP_RAND implementation. That's the name, periodt. β¨
πΈ DESCRIPTION πΈ
This page is all about support for the HMAC deterministic random bit generator through the EVP_RAND API. π
πͺͺ Identity πͺͺ
"HMAC-DRBG" is literally the name for this implementation, and you can use it with the EVP_RAND_fetch() function. iykyk. β¨
π Supported parameters π
The supported parameters are:
"state"(OSSL_RAND_PARAM_STATE) β<integer>"strength"(OSSL_RAND_PARAM_STRENGTH) β<unsigned integer>"max_request"(OSSL_RAND_PARAM_MAX_REQUEST) β<unsigned integer>"reseed_requests"(OSSL_DRBG_PARAM_RESEED_REQUESTS) β<unsigned integer>"reseed_time_interval"(OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL) β<integer>"min_entropylen"(OSSL_DRBG_PARAM_MIN_ENTROPYLEN) β<unsigned integer>"max_entropylen"(OSSL_DRBG_PARAM_MAX_ENTROPYLEN) β<unsigned integer>"min_noncelen"(OSSL_DRBG_PARAM_MIN_NONCELEN) β<unsigned integer>"max_noncelen"(OSSL_DRBG_PARAM_MAX_NONCELEN) β<unsigned integer>"max_perslen"(OSSL_DRBG_PARAM_MAX_PERSLEN) β<unsigned integer>"max_adinlen"(OSSL_DRBG_PARAM_MAX_ADINLEN) β<unsigned integer>"reseed_counter"(OSSL_DRBG_PARAM_RESEED_COUNTER) β<unsigned integer>"properties"(OSSL_DRBG_PARAM_PROPERTIES) β<UTF8 string>"mac"(OSSL_DRBG_PARAM_MAC) β<UTF8 string>"digest"(OSSL_DRBG_PARAM_DIGEST) β<UTF8 string>
These parameters work as described in "PARAMETERS" in EVP_RAND(3). π
And the FIPS-flavored ones:
"fips-indicator"(OSSL_DRBG_PARAM_FIPS_APPROVED_INDICATOR) β<integer>"digest-check"(OSSL_DRBG_PARAM_FIPS_DIGEST_CHECK) β<integer>
These parameters work as described in "PARAMETERS" in provider-rand(7). π«Ά
π₯ NOTES π₯
FIPS heads up: when using the FIPS provider, only these digests are permitted (as per FIPS 140-3 IG D.R at <https://csrc.nist.gov/CSRC/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf>):
The default HMAC-DRBG implementation attempts to fetch the required internal algorithms from the provider they are built into (eg the default provider) regardless of the properties provided. Should the provider not implement the required algorithms then properties will be used to find a different implementation.
The permitted digest list is:
SHA-1SHA2-256SHA2-512SHA3-256SHA3-512
A context for HMAC DRBG can be obtained by calling:
EVP_RAND *rand = EVP_RAND_fetch(NULL, "HMAC-DRBG", NULL);
EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand, NULL);
π EXAMPLES π
Here's the whole vibe in code, fr fr:
EVP_RAND *rand;
EVP_RAND_CTX *rctx;
unsigned char bytes[100];
OSSL_PARAM params[3], *p = params;
unsigned int strength = 128;
rand = EVP_RAND_fetch(NULL, "HMAC-DRBG", NULL);
rctx = EVP_RAND_CTX_new(rand, NULL);
EVP_RAND_free(rand);
*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_instantiate(rctx, strength, 0, NULL, 0, params);
EVP_RAND_generate(rctx, bytes, sizeof(bytes), strength, 0, NULL, 0);
EVP_RAND_CTX_free(rctx);
β CONFORMING TO β
NIST SP 800-90A and SP 800-90B β that's the standard vibe. π
π¦ SEE ALSO π¦
EVP_RAND(3)"PARAMETERS" in EVP_RAND(3)openssl-fipsinstall(1)
π§ HISTORY π§
OpenSSL 3.1.1 introduced the -no_drbg_truncated_digests option to fipsinstall which restricts the permitted digests when using the FIPS provider in a complaint manner. For details refer to FIPS 140-3 IG D.R (<https://csrc.nist.gov/CSRC/media/Projects/cryptographic-module-validation-program/documents/fips%20140-3/FIPS%20140-3%20IG.pdf>). π«Ά
π COPYRIGHT π
Copyright 2020-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
okay that's the whole page, mwah π
β this was OpenSSL version 3.5.9, dated 2026-09-29, for EVP_RAND-HMAC-DRBG(7ossl). π«Ά
π¦ where this page comes from
- alpine 3.23: openssl-doc 3.5.9-r0 Β· Apache-2.0
- alpine 3.24: openssl-doc 3.5.9-r0 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms