EVP_RAND-CTR-DRBG(7ossl)
π NAME π
bestie, this is EVP_RAND-CTR-DRBG(7ossl), an OpenSSL manual page, and the name is literally EVP_RAND-CTR-DRBG β the CTR DRBG EVP_RAND implementation. that's the whole vibe. periodt. π
β¨ DESCRIPTION β¨
okay so this is support for the counter deterministic random bit generator through the EVP_RAND API. iconic behavior, no cap. π¦
πͺͺ Identity πͺͺ
"CTR-DRBG" is the name for this implementation, and you can use it with the EVP_RAND_fetch() function. iykyk. π
ποΈ Supported parameters ποΈ
the supported parameters are giving parameter menu, and yes we're listing every single one:
"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>"cipher"(OSSL_DRBG_PARAM_CIPHER) β<UTF8 string>
these parameters work exactly as described in "PARAMETERS" in EVP_RAND(3). slay. π«Ά
"use_derivation_function"(OSSL_DRBG_PARAM_USE_DF) β<integer>. this Boolean tells you if a derivation function should be used or not. a nonzero value (the default) uses the derivation function. a zero value does not. simple as that, bestie. π
π NOTES π
a context for CTR DRBG can be obtained by calling:
EVP_RAND *rand = EVP_RAND_fetch(NULL, "CTR-DRBG", NULL);
EVP_RAND_CTX *rctx = EVP_RAND_CTX_new(rand, NULL);
the default CTR-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. that's the tea. ββ¨
π§ͺ EXAMPLES π§ͺ
here's the example, bestie β every line, every character, no edits, no cap:
EVP_RAND *rand;
EVP_RAND_CTX *rctx;
unsigned char bytes[100];
OSSL_PARAM params[2], *p = params;
unsigned int strength = 128;
rand = EVP_RAND_fetch(NULL, "CTR-DRBG", NULL);
rctx = EVP_RAND_CTX_new(rand, NULL);
EVP_RAND_free(rand);
*p++ = OSSL_PARAM_construct_utf8_string(OSSL_DRBG_PARAM_CIPHER,
SN_aes_256_ctr, 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. the standards are standard-ing. ππ
π SEE ALSO π
EVP_RAND(3), and "PARAMETERS" in EVP_RAND(3). go read those too, bestie. π
Β©οΈ 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 bye bestie π this was OpenSSL 3.5.0, dated 2026-09-25, for EVP_RAND-CTR-DRBG(7ossl) β slay responsibly, and may your randomness be deterministic but never boring β¨π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- opensuse-leap 16.0: openssl-3 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms