Update the *use_certificate* docs
[openssl.git] / doc / man3 / RAND_add.pod
1 =pod
2
3 =head1 NAME
4
5 RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen
6 - add randomness to the PRNG or get its status
7
8 =head1 SYNOPSIS
9
10  #include <openssl/rand.h>
11
12  int RAND_status(void);
13  int RAND_poll();
14
15  void RAND_add(const void *buf, int num, double randomness);
16  void RAND_seed(const void *buf, int num);
17
18 Deprecated:
19
20  #if OPENSSL_API_COMPAT < 0x10100000L
21  int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
22  void RAND_screen(void);
23  #endif
24
25 =head1 DESCRIPTION
26
27 These functions can be used to seed the random generator and to check its
28 seeded state.
29 In general, manual (re-)seeding of the default OpenSSL random generator
30 (L<RAND_OpenSSL(3)>) is not necessary (but allowed), since it does (re-)seed
31 itself automatically using trusted system entropy sources.
32 This holds unless the default RAND_METHOD has been replaced or OpenSSL was
33 built with automatic reseeding disabled, see L<RAND(7)> for more details.
34
35 RAND_status() indicates whether or not the random generator has been sufficiently
36 seeded. If not, functions such as L<RAND_bytes(3)> will fail.
37
38 RAND_poll() uses the system's capabilities to seed the random generator using
39 random input obtained from polling various trusted entropy sources.
40 The default choice of the entropy source can be modified at build time,
41 see L<RAND(7)> for more details.
42
43 RAND_add() mixes the B<num> bytes at B<buf> into the internal state
44 of the random generator.
45 This function will not normally be needed, as mentioned above.
46 The B<randomness> argument is an estimate of how much randomness is
47 contained in
48 B<buf>, in bytes, and should be a number between zero and B<num>.
49 Details about sources of randomness and how to estimate their randomness
50 can be found in the literature; for example [NIST SP 800-90B].
51 The content of B<buf> cannot be recovered from subsequent random generator output.
52 Applications that intend to save and restore random state in an external file
53 should consider using L<RAND_load_file(3)> instead.
54
55 RAND_seed() is equivalent to RAND_add() with B<randomness> set to B<num>.
56
57 RAND_event() and RAND_screen() are equivalent to RAND_poll() and exist
58 for compatibility reasons only. See HISTORY section below.
59
60 =head1 RETURN VALUES
61
62 RAND_status() returns 1 if the random generator has been seeded
63 with enough data, 0 otherwise.
64
65 RAND_poll() returns 1 if it generated seed data, 0 otherwise.
66
67 RAND_event() returns RAND_status().
68
69 The other functions do not return values.
70
71 =head1 HISTORY
72
73 RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should
74 not be used.
75
76 =head1 SEE ALSO
77
78 L<RAND_bytes(3)>,
79 L<RAND_egd(3)>,
80 L<RAND_load_file(3)>,
81 L<RAND(7)>
82
83 =head1 COPYRIGHT
84
85 Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
86
87 Licensed under the OpenSSL license (the "License").  You may not use
88 this file except in compliance with the License.  You can obtain a copy
89 in the file LICENSE in the source distribution or at
90 L<https://www.openssl.org/source/license.html>.
91
92 =cut