1=pod 2 3=head1 NAME 4 5RAND_set_DRBG_type, 6RAND_set_seed_source_type 7- specify the global random number generator types 8 9=head1 SYNOPSIS 10 11 #include <openssl/rand.h> 12 13 int RAND_set_DRBG_type(OSSL_LIB_CTX *ctx, const char *drbg, const char *propq, 14 const char *cipher, const char *digest); 15 int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed, 16 const char *propq); 17 18=head1 DESCRIPTION 19 20RAND_set_DRBG_type() specifies the random bit generator that will be 21used within the library context I<ctx>. A generator of name I<drbg> 22with properties I<propq> will be fetched. It will be instantiated with 23either I<cipher> or I<digest> as its underlying cryptographic algorithm. 24This specifies the type that will be used for the primary, public and 25private random instances. 26 27RAND_set_seed_source_type() specifies the seed source that will be used 28within the library context I<ctx>. The seed source of name I<seed> 29with properties I<propq> will be fetched and used to seed the primary 30random bit generator. 31 32=head1 RETURN VALUES 33 34These function return 1 on success and 0 on failure. 35 36=head1 NOTES 37 38These functions must be called before the random bit generators are first 39created in the library context. They will return an error if the call 40is made too late. 41 42The default DRBG is "CTR-DRBG" using the "AES-256-CTR" cipher. 43 44The default seed source can be configured when OpenSSL is compiled by 45setting B<-DOPENSSL_DEFAULT_SEED_SRC=SEED-SRC>. If not set then 46"SEED-SRC" is used. 47 48=head1 EXAMPLES 49 50 unsigned char bytes[100]; 51 RAND_set_seed_source_type(NULL, "JITTER", NULL); 52 RAND_bytes(bytes, 100); 53 54=head1 SEE ALSO 55 56L<EVP_RAND(3)>, 57L<RAND_get0_primary(3)> 58 59=head1 HISTORY 60 61These functions were added in OpenSSL 3.0. 62 63=head1 COPYRIGHT 64 65Copyright 2021-2024 The OpenSSL Project Authors. All Rights Reserved. 66 67Licensed under the Apache License 2.0 (the "License"). You may not use 68this file except in compliance with the License. You can obtain a copy 69in the file LICENSE in the source distribution or at 70L<https://www.openssl.org/source/license.html>. 71 72=cut 73