mirror of
https://github.com/openssl/openssl.git
synced 2024-12-03 05:41:46 +08:00
7d615e2178
The RAND_DRBG API did not fit well into the new provider concept as implemented by EVP_RAND and EVP_RAND_CTX. The main reason is that the RAND_DRBG API is a mixture of 'front end' and 'back end' API calls and some of its API calls are rather low-level. This holds in particular for the callback mechanism (RAND_DRBG_set_callbacks()) and the RAND_DRBG type changing mechanism (RAND_DRBG_set()). Adding a compatibility layer to continue supporting the RAND_DRBG API as a legacy API for a regular deprecation period turned out to come at the price of complicating the new provider API unnecessarily. Since the RAND_DRBG API exists only since version 1.1.1, it was decided by the OMC to drop it entirely. Other related changes: Use RNG instead of DRBG in EVP_RAND documentation. The documentation was using DRBG in places where it should have been RNG or CSRNG. Move the RAND_DRBG(7) documentation to EVP_RAND(7). Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/12509)
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
=pod
|
|
|
|
=head1 NAME
|
|
|
|
RAND_get0_primary,
|
|
RAND_get0_public,
|
|
RAND_get0_private
|
|
- get access to the global EVP_RAND_CTX instances
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
#include <openssl/rand.h>
|
|
|
|
EVP_RAND_CTX *RAND_get0_primary(OPENSSL_CTX *ctx);
|
|
EVP_RAND_CTX *RAND_get0_public(OPENSSL_CTX *ctx);
|
|
EVP_RAND_CTX *RAND_get0_private(OPENSSL_CTX *ctx);
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
The default RAND API implementation (RAND_OpenSSL()) utilizes three
|
|
shared DRBG instances which are accessed via the RAND API:
|
|
|
|
The I<public> and I<private> DRBG are thread-local instances, which are used
|
|
by RAND_bytes() and RAND_priv_bytes(), respectively.
|
|
The I<primary> DRBG is a global instance, which is not intended to be used
|
|
directly, but is used internally to reseed the other two instances.
|
|
|
|
These functions here provide access to the shared DRBG instances.
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
RAND_get0_primary() returns a pointer to the I<primary> DRBG instance
|
|
for the given OPENSSL_CTX B<ctx>.
|
|
|
|
RAND_get0_public() returns a pointer to the I<public> DRBG instance
|
|
for the given OPENSSL_CTX B<ctx>.
|
|
|
|
RAND_get0_private() returns a pointer to the I<private> DRBG instance
|
|
for the given OPENSSL_CTX B<ctx>.
|
|
|
|
In all the above cases the B<ctx> parameter can
|
|
be NULL in which case the default OPENSSL_CTX is used.
|
|
|
|
=head1 NOTES
|
|
|
|
It is not thread-safe to access the I<primary> DRBG instance.
|
|
The I<public> and I<private> DRBG instance can be accessed safely, because
|
|
they are thread-local. Note however, that changes to these two instances
|
|
apply only to the current thread.
|
|
|
|
For that reason it is recommended not to change the settings of these
|
|
three instances directly.
|
|
Instead, an application should change the default settings for new DRBG instances
|
|
at initialization time, before creating additional threads.
|
|
|
|
During initialization, it is possible to change the reseed interval
|
|
and reseed time interval.
|
|
It is also possible to exchange the reseeding callbacks entirely.
|
|
|
|
=head1 SEE ALSO
|
|
|
|
L<EVP_RAND(3)>
|
|
|
|
=head1 HISTORY
|
|
|
|
These functions were added in OpenSSL 3.0.
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
=cut
|