EVP_RAND-CTR-DRBG(7ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’– 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 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