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