xref: /freebsd/secure/lib/libcrypto/man/man3/RAND_add.3 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "RAND_ADD 3ossl"
RAND_ADD 3ossl "2023-09-19" "3.0.11" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen, RAND_keep_random_devices_open \- add randomness to the PRNG or get its status
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/rand.h> \& int RAND_status(void); int RAND_poll(); \& void RAND_add(const void *buf, int num, double randomness); void RAND_seed(const void *buf, int num); \& void RAND_keep_random_devices_open(int keep); .Ve

The following functions have been deprecated since OpenSSL 1.1.0, and can be hidden entirely by defining \s-1OPENSSL_API_COMPAT\s0 with a suitable version value, see openssl_user_macros\|(7):

.Vb 2 int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam); void RAND_screen(void); .Ve

"DESCRIPTION"
Header "DESCRIPTION" These functions can be used to seed the random generator and to check its seeded state. In general, manual (re-)seeding of the default OpenSSL random generator (RAND_OpenSSL\|(3)) is not necessary (but allowed), since it does (re-)seed itself automatically using trusted system entropy sources. This holds unless the default \s-1RAND_METHOD\s0 has been replaced or OpenSSL was built with automatic reseeding disabled, see \s-1RAND\s0\|(7) for more details.

\fBRAND_status() indicates whether or not the random generator has been sufficiently seeded. If not, functions such as RAND_bytes\|(3) will fail.

\fBRAND_poll() uses the system's capabilities to seed the random generator using random input obtained from polling various trusted entropy sources. The default choice of the entropy source can be modified at build time, see \s-1RAND\s0\|(7) for more details.

\fBRAND_add() mixes the num bytes at buf into the internal state of the random generator. This function will not normally be needed, as mentioned above. The randomness argument is an estimate of how much randomness is contained in \fBbuf, in bytes, and should be a number between zero and num. Details about sources of randomness and how to estimate their randomness can be found in the literature; for example [\s-1NIST SP 800-90B\s0]. The content of buf cannot be recovered from subsequent random generator output. Applications that intend to save and restore random state in an external file should consider using RAND_load_file\|(3) instead.

\s-1NOTE:\s0 In \s-1FIPS\s0 mode, random data provided by the application is not considered to be a trusted entropy source. It is mixed into the internal state of the \s-1RNG\s0 as additional data only and this does not count as a full reseed. For more details, see \s-1EVP_RAND\s0\|(7).

\fBRAND_seed() is equivalent to RAND_add() with randomness set to num.

\fBRAND_keep_random_devices_open() is used to control file descriptor usage by the random seed sources. Some seed sources maintain open file descriptors by default, which allows such sources to operate in a \fBchroot\|(2) jail without the associated device nodes being available. When the keep argument is zero, this call disables the retention of file descriptors. Conversely, a nonzero argument enables the retention of file descriptors. This function is usually called during initialization and it takes effect immediately. This capability only applies to the default provider.

\fBRAND_event() and RAND_screen() are equivalent to RAND_poll() and exist for compatibility reasons only. See \s-1HISTORY\s0 section below.

"RETURN VALUES"
Header "RETURN VALUES" \fBRAND_status() returns 1 if the random generator has been seeded with enough data, 0 otherwise.

\fBRAND_poll() returns 1 if it generated seed data, 0 otherwise.

\fBRAND_event() returns RAND_status().

The other functions do not return values.

"SEE ALSO"
Header "SEE ALSO" \fBRAND_bytes\|(3), \fBRAND_egd\|(3), \fBRAND_load_file\|(3), \s-1RAND\s0\|(7) \s-1EVP_RAND\s0\|(7)
"HISTORY"
Header "HISTORY" \fBRAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should not be used.
"COPYRIGHT"
Header "COPYRIGHT" Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.