Blame doc/man3/RAND_DRBG_generate.pod

Packit c4476c
=pod
Packit c4476c
Packit c4476c
=head1 NAME
Packit c4476c
Packit c4476c
RAND_DRBG_generate,
Packit c4476c
RAND_DRBG_bytes
Packit c4476c
- generate random bytes using the given drbg instance
Packit c4476c
Packit c4476c
=head1 SYNOPSIS
Packit c4476c
Packit c4476c
 #include <openssl/rand_drbg.h>
Packit c4476c
Packit c4476c
 int RAND_DRBG_generate(RAND_DRBG *drbg,
Packit c4476c
                        unsigned char *out, size_t outlen,
Packit c4476c
                        int prediction_resistance,
Packit c4476c
                        const unsigned char *adin, size_t adinlen);
Packit c4476c
Packit c4476c
 int RAND_DRBG_bytes(RAND_DRBG *drbg,
Packit c4476c
                     unsigned char *out, size_t outlen);
Packit c4476c
Packit c4476c
Packit c4476c
=head1 DESCRIPTION
Packit c4476c
Packit c4476c
RAND_DRBG_generate() generates B<outlen> random bytes using the given
Packit c4476c
DRBG instance B<drbg> and stores them in the buffer at B<out>.
Packit c4476c
Packit c4476c
Before generating the output, the DRBG instance checks whether the maximum
Packit c4476c
number of generate requests (I<reseed interval>) or the maximum timespan
Packit c4476c
(I<reseed time interval>) since its last seeding have been reached.
Packit c4476c
If this is the case, the DRBG reseeds automatically.
Packit c4476c
Additionally, an immediate reseeding can be requested by setting the
Packit c4476c
B<prediction_resistance> flag to 1. See NOTES section for more details.
Packit c4476c
Packit c4476c
The caller can optionally provide additional data to be used for reseeding
Packit c4476c
by passing a pointer B<adin> to a buffer of length B<adinlen>.
Packit c4476c
This additional data is mixed into the internal state of the random
Packit c4476c
generator but does not contribute to the entropy count.
Packit c4476c
The additional data can be omitted by setting B<adin> to NULL and
Packit c4476c
B<adinlen> to 0;
Packit c4476c
Packit c4476c
RAND_DRBG_bytes() generates B<outlen> random bytes using the given
Packit c4476c
DRBG instance B<drbg> and stores them in the buffer at B<out>.
Packit c4476c
This function is a wrapper around the RAND_DRBG_generate() call,
Packit c4476c
which collects some additional data from low entropy sources
Packit c4476c
(e.g., a high resolution timer) and calls
Packit c4476c
RAND_DRBG_generate(drbg, out, outlen, 0, adin, adinlen).
Packit c4476c
Packit c4476c
Packit c4476c
=head1 RETURN VALUES
Packit c4476c
Packit c4476c
RAND_DRBG_generate() and RAND_DRBG_bytes() return 1 on success,
Packit c4476c
and 0 on failure.
Packit c4476c
Packit c4476c
=head1 NOTES
Packit c4476c
Packit c4476c
The I<reseed interval> and I<reseed time interval> of the B<drbg> are set to
Packit c4476c
reasonable default values, which in general do not have to be adjusted.
Packit c4476c
If necessary, they can be changed using L<RAND_DRBG_set_reseed_interval(3)>
Packit c4476c
and L<RAND_DRBG_set_reseed_time_interval(3)>, respectively.
Packit c4476c
Packit c4476c
A request for prediction resistance can only be satisfied by pulling fresh
Packit c4476c
entropy from one of the approved entropy sources listed in section 5.5.2 of
Packit c4476c
[NIST SP 800-90C].
Packit c4476c
Since the default DRBG implementation does not have access to such an approved
Packit c4476c
entropy source, a request for prediction resistance will always fail.
Packit c4476c
In other words, prediction resistance is currently not supported yet by the DRBG.
Packit c4476c
Packit c4476c
=head1 SEE ALSO
Packit c4476c
Packit c4476c
L<RAND_bytes(3)>,
Packit c4476c
L<RAND_DRBG_set_reseed_interval(3)>,
Packit c4476c
L<RAND_DRBG_set_reseed_time_interval(3)>,
Packit c4476c
L<RAND_DRBG(7)>
Packit c4476c
Packit c4476c
=head1 HISTORY
Packit c4476c
Packit c4476c
The RAND_DRBG functions were added in OpenSSL 1.1.1.
Packit c4476c
Packit c4476c
=head1 COPYRIGHT
Packit c4476c
Packit c4476c
Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
Packit c4476c
Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
this file except in compliance with the License.  You can obtain a copy
Packit c4476c
in the file LICENSE in the source distribution or at
Packit c4476c
L<https://www.openssl.org/source/license.html>.
Packit c4476c
Packit c4476c
=cut