Home | History | Annotate | Line # | Download | only in man3
      1  1.1  christos =pod
      2  1.1  christos 
      3  1.1  christos =head1 NAME
      4  1.1  christos 
      5  1.1  christos RAND_get0_primary,
      6  1.1  christos RAND_get0_public,
      7  1.1  christos RAND_get0_private
      8  1.1  christos - get access to the global EVP_RAND_CTX instances
      9  1.1  christos 
     10  1.1  christos =head1 SYNOPSIS
     11  1.1  christos 
     12  1.1  christos  #include <openssl/rand.h>
     13  1.1  christos 
     14  1.1  christos  EVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx);
     15  1.1  christos  EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx);
     16  1.1  christos  EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx);
     17  1.1  christos 
     18  1.1  christos =head1 DESCRIPTION
     19  1.1  christos 
     20  1.1  christos The default RAND API implementation (RAND_OpenSSL()) utilizes three
     21  1.1  christos shared DRBG instances which are accessed via the RAND API:
     22  1.1  christos 
     23  1.1  christos The I<public> and I<private> DRBG are thread-local instances, which are used
     24  1.1  christos by RAND_bytes() and RAND_priv_bytes(), respectively.
     25  1.1  christos The I<primary> DRBG is a global instance, which is not intended to be used
     26  1.1  christos directly, but is used internally to reseed the other two instances.
     27  1.1  christos 
     28  1.1  christos These functions here provide access to the shared DRBG instances.
     29  1.1  christos 
     30  1.1  christos =head1 RETURN VALUES
     31  1.1  christos 
     32  1.1  christos RAND_get0_primary() returns a pointer to the I<primary> DRBG instance
     33  1.1  christos for the given OSSL_LIB_CTX B<ctx>.
     34  1.1  christos 
     35  1.1  christos RAND_get0_public() returns a pointer to the I<public> DRBG instance
     36  1.1  christos for the given OSSL_LIB_CTX B<ctx>.
     37  1.1  christos 
     38  1.1  christos RAND_get0_private() returns a pointer to the I<private> DRBG instance
     39  1.1  christos for the given OSSL_LIB_CTX B<ctx>.
     40  1.1  christos 
     41  1.1  christos In all the above cases the B<ctx> parameter can
     42  1.1  christos be NULL in which case the default OSSL_LIB_CTX is used.
     43  1.1  christos 
     44  1.1  christos =head1 NOTES
     45  1.1  christos 
     46  1.1  christos It is not thread-safe to access the I<primary> DRBG instance.
     47  1.1  christos The I<public> and I<private> DRBG instance can be accessed safely, because
     48  1.1  christos they are thread-local. Note however, that changes to these two instances
     49  1.1  christos apply only to the current thread.
     50  1.1  christos 
     51  1.1  christos For that reason it is recommended not to change the settings of these
     52  1.1  christos three instances directly.
     53  1.1  christos Instead, an application should change the default settings for new DRBG instances
     54  1.1  christos at initialization time, before creating additional threads.
     55  1.1  christos 
     56  1.1  christos During initialization, it is possible to change the reseed interval
     57  1.1  christos and reseed time interval.
     58  1.1  christos It is also possible to exchange the reseeding callbacks entirely.
     59  1.1  christos 
     60  1.1  christos To set the type of DRBG that will be instantiated, use the
     61  1.1  christos L<RAND_set_DRBG_type(3)> call before accessing the random number generation
     62  1.1  christos infrastructure.
     63  1.1  christos 
     64  1.1  christos =head1 SEE ALSO
     65  1.1  christos 
     66  1.1  christos L<EVP_RAND(3)>,
     67  1.1  christos L<RAND_set_DRBG_type(3)>
     68  1.1  christos 
     69  1.1  christos =head1 HISTORY
     70  1.1  christos 
     71  1.1  christos These functions were added in OpenSSL 3.0.
     72  1.1  christos 
     73  1.1  christos =head1 COPYRIGHT
     74  1.1  christos 
     75  1.1  christos Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
     76  1.1  christos 
     77  1.1  christos Licensed under the Apache License 2.0 (the "License").  You may not use
     78  1.1  christos this file except in compliance with the License.  You can obtain a copy
     79  1.1  christos in the file LICENSE in the source distribution or at
     80  1.1  christos L<https://www.openssl.org/source/license.html>.
     81  1.1  christos 
     82  1.1  christos =cut
     83