RAND_set_DRBG_type.3ossl - Man Page

specify the global random number generator types


 #include <openssl/rand.h>

 int RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq,
                        const char *cipher, const char *digest);
 int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed,
                               const char *propq);


RAND_set_DRBG_type() specifies the random bit generator that will be used within the library context ctx.  A generator of name drbg with properties propq will be fetched.  It will be instantiated with either cipher or digest as its underlying cryptographic algorithm. This specifies the type that will be used for the primary, public and private random instances.

RAND_set_seed_source_type() specifies the seed source that will be used within the library context ctx.  The seed source of name seed with properties propq will be fetched and used to seed the primary random big generator.

Return Values

These function return 1 on success and 0 on failure.


These functions must be called before the random bit generators are first created in the library context.  They will return an error if the call is made too late.

The default DRBG is "CTR-DRBG" using the "AES-256-CTR" cipher.

The default seed source is "SEED-SRC".

See Also

EVP_RAND(3), RAND_get0_primary(3)


These functions were added in OpenSSL 3.0.

Referenced By

migration_guide.7ossl(7), RAND_get0_primary.3ossl(3), RAND_set_rand_method.3ossl(3).

The man page RAND_set_seed_source_type.3ossl(3) is an alias of RAND_set_DRBG_type.3ossl(3).

2023-03-21 3.0.8 OpenSSL