1RAND_GET0_PRIMARY(3ossl)            OpenSSL           RAND_GET0_PRIMARY(3ossl)
2
3
4

NAME

6       RAND_get0_primary, RAND_get0_public, RAND_get0_private - get access to
7       the global EVP_RAND_CTX instances
8

SYNOPSIS

10        #include <openssl/rand.h>
11
12        EVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx);
13        EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx);
14        EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx);
15

DESCRIPTION

17       The default RAND API implementation (RAND_OpenSSL()) utilizes three
18       shared DRBG instances which are accessed via the RAND API:
19
20       The public and private DRBG are thread-local instances, which are used
21       by RAND_bytes() and RAND_priv_bytes(), respectively.  The primary DRBG
22       is a global instance, which is not intended to be used directly, but is
23       used internally to reseed the other two instances.
24
25       These functions here provide access to the shared DRBG instances.
26

RETURN VALUES

28       RAND_get0_primary() returns a pointer to the primary DRBG instance for
29       the given OSSL_LIB_CTX ctx.
30
31       RAND_get0_public() returns a pointer to the public DRBG instance for
32       the given OSSL_LIB_CTX ctx.
33
34       RAND_get0_private() returns a pointer to the private DRBG instance for
35       the given OSSL_LIB_CTX ctx.
36
37       In all the above cases the ctx parameter can be NULL in which case the
38       default OSSL_LIB_CTX is used.
39

NOTES

41       It is not thread-safe to access the primary DRBG instance.  The public
42       and private DRBG instance can be accessed safely, because they are
43       thread-local. Note however, that changes to these two instances apply
44       only to the current thread.
45
46       For that reason it is recommended not to change the settings of these
47       three instances directly.  Instead, an application should change the
48       default settings for new DRBG instances at initialization time, before
49       creating additional threads.
50
51       During initialization, it is possible to change the reseed interval and
52       reseed time interval.  It is also possible to exchange the reseeding
53       callbacks entirely.
54
55       To set the type of DRBG that will be instantiated, use the
56       RAND_set_DRBG_type(3) call before accessing the random number
57       generation infrastructure.
58

SEE ALSO

60       EVP_RAND(3), RAND_set_DRBG_type(3)
61

HISTORY

63       These functions were added in OpenSSL 3.0.
64
66       Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
67
68       Licensed under the Apache License 2.0 (the "License").  You may not use
69       this file except in compliance with the License.  You can obtain a copy
70       in the file LICENSE in the source distribution or at
71       <https://www.openssl.org/source/license.html>.
72
73
74
753.0.5                             2022-11-01          RAND_GET0_PRIMARY(3ossl)
Impressum