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

NAME

6       RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen,
7       RAND_keep_random_devices_open - add randomness to the PRNG or get its
8       status
9

SYNOPSIS

11        #include <openssl/rand.h>
12
13        int RAND_status(void);
14        int RAND_poll();
15
16        void RAND_add(const void *buf, int num, double randomness);
17        void RAND_seed(const void *buf, int num);
18
19        void RAND_keep_random_devices_open(int keep);
20
21       The following functions have been deprecated since OpenSSL 1.1.0, and
22       can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
23       version value, see openssl_user_macros(7):
24
25        int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
26        void RAND_screen(void);
27

DESCRIPTION

29       These functions can be used to seed the random generator and to check
30       its seeded state.  In general, manual (re-)seeding of the default
31       OpenSSL random generator (RAND_OpenSSL(3)) is not necessary (but
32       allowed), since it does (re-)seed itself automatically using trusted
33       system entropy sources.  This holds unless the default RAND_METHOD has
34       been replaced or OpenSSL was built with automatic reseeding disabled,
35       see RAND(7) for more details.
36
37       RAND_status() indicates whether or not the random generator has been
38       sufficiently seeded. If not, functions such as RAND_bytes(3) will fail.
39
40       RAND_poll() uses the system's capabilities to seed the random generator
41       using random input obtained from polling various trusted entropy
42       sources.  The default choice of the entropy source can be modified at
43       build time, see RAND(7) for more details.
44
45       RAND_add() mixes the num bytes at buf into the internal state of the
46       random generator.  This function will not normally be needed, as
47       mentioned above.  The randomness argument is an estimate of how much
48       randomness is contained in buf, in bytes, and should be a number
49       between zero and num.  Details about sources of randomness and how to
50       estimate their randomness can be found in the literature; for example
51       [NIST SP 800-90B].  The content of buf cannot be recovered from
52       subsequent random generator output.  Applications that intend to save
53       and restore random state in an external file should consider using
54       RAND_load_file(3) instead.
55
56       NOTE: In FIPS mode, random data provided by the application is not
57       considered to be a trusted entropy source. It is mixed into the
58       internal state of the RNG as additional data only and this does not
59       count as a full reseed.  For more details, see EVP_RAND(7).
60
61       RAND_seed() is equivalent to RAND_add() with randomness set to num.
62
63       RAND_keep_random_devices_open() is used to control file descriptor
64       usage by the random seed sources. Some seed sources maintain open file
65       descriptors by default, which allows such sources to operate in a
66       chroot(2) jail without the associated device nodes being available.
67       When the keep argument is zero, this call disables the retention of
68       file descriptors. Conversely, a nonzero argument enables the retention
69       of file descriptors. This function is usually called during
70       initialization and it takes effect immediately. This capability only
71       applies to the default provider.
72
73       RAND_event() and RAND_screen() are equivalent to RAND_poll() and exist
74       for compatibility reasons only. See HISTORY section below.
75

RETURN VALUES

77       RAND_status() returns 1 if the random generator has been seeded with
78       enough data, 0 otherwise.
79
80       RAND_poll() returns 1 if it generated seed data, 0 otherwise.
81
82       RAND_event() returns RAND_status().
83
84       The other functions do not return values.
85

SEE ALSO

87       RAND_bytes(3), RAND_egd(3), RAND_load_file(3), RAND(7) EVP_RAND(7)
88

HISTORY

90       RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and
91       should not be used.
92
94       Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
95
96       Licensed under the Apache License 2.0 (the "License").  You may not use
97       this file except in compliance with the License.  You can obtain a copy
98       in the file LICENSE in the source distribution or at
99       <https://www.openssl.org/source/license.html>.
100
101
102
1033.0.9                             2023-07-27                   RAND_ADD(3ossl)
Impressum