1RAND_DRBG_GENERATE(3)               OpenSSL              RAND_DRBG_GENERATE(3)
2
3
4

NAME

6       RAND_DRBG_generate, RAND_DRBG_bytes - generate random bytes using the
7       given drbg instance
8

SYNOPSIS

10        #include <openssl/rand_drbg.h>
11
12        int RAND_DRBG_generate(RAND_DRBG *drbg,
13                               unsigned char *out, size_t outlen,
14                               int prediction_resistance,
15                               const unsigned char *adin, size_t adinlen);
16
17        int RAND_DRBG_bytes(RAND_DRBG *drbg,
18                            unsigned char *out, size_t outlen);
19

DESCRIPTION

21       RAND_DRBG_generate() generates outlen random bytes using the given DRBG
22       instance drbg and stores them in the buffer at out.
23
24       Before generating the output, the DRBG instance checks whether the
25       maximum number of generate requests (reseed interval) or the maximum
26       timespan (reseed time interval) since its last seeding have been
27       reached.  If this is the case, the DRBG reseeds automatically.
28       Additionally, an immediate reseeding can be requested by setting the
29       prediction_resistance flag to 1. See NOTES section for more details.
30
31       The caller can optionally provide additional data to be used for
32       reseeding by passing a pointer adin to a buffer of length adinlen.
33       This additional data is mixed into the internal state of the random
34       generator but does not contribute to the entropy count.  The additional
35       data can be omitted by setting adin to NULL and adinlen to 0;
36
37       RAND_DRBG_bytes() generates outlen random bytes using the given DRBG
38       instance drbg and stores them in the buffer at out.  This function is a
39       wrapper around the RAND_DRBG_generate() call, which collects some
40       additional data from low entropy sources (e.g., a high resolution
41       timer) and calls RAND_DRBG_generate(drbg, out, outlen, 0, adin,
42       adinlen).
43

RETURN VALUES

45       RAND_DRBG_generate() and RAND_DRBG_bytes() return 1 on success, and 0
46       on failure.
47

NOTES

49       The reseed interval and reseed time interval of the drbg are set to
50       reasonable default values, which in general do not have to be adjusted.
51       If necessary, they can be changed using
52       RAND_DRBG_set_reseed_interval(3) and
53       RAND_DRBG_set_reseed_time_interval(3), respectively.
54
55       A request for prediction resistance can only be satisfied by pulling
56       fresh entropy from one of the approved entropy sources listed in
57       section 5.5.2 of [NIST SP 800-90C].  Since the default DRBG
58       implementation does not have access to such an approved entropy source,
59       a request for prediction resistance will always fail.  In other words,
60       prediction resistance is currently not supported yet by the DRBG.
61

SEE ALSO

63       RAND_bytes(3), RAND_DRBG_set_reseed_interval(3),
64       RAND_DRBG_set_reseed_time_interval(3), RAND_DRBG(7)
65

HISTORY

67       The RAND_DRBG functions were added in OpenSSL 1.1.1.
68
70       Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
71
72       Licensed under the OpenSSL license (the "License").  You may not use
73       this file except in compliance with the License.  You can obtain a copy
74       in the file LICENSE in the source distribution or at
75       <https://www.openssl.org/source/license.html>.
76
77
78
791.1.1i                            2021-07-22             RAND_DRBG_GENERATE(3)
Impressum