1RAND(7)                             OpenSSL                            RAND(7)
2
3
4

NAME

6       RAND - the OpenSSL random generator
7

DESCRIPTION

9       Random numbers are a vital part of cryptography, they are needed to
10       provide unpredictability for tasks like key generation, creating salts,
11       and many more.  Software-based generators must be seeded with external
12       randomness before they can be used as a cryptographically-secure
13       pseudo-random number generator (CSPRNG).  The availability of common
14       hardware with special instructions and modern operating systems, which
15       may use items such as interrupt jitter and network packet timings, can
16       be reasonable sources of seeding material.
17
18       OpenSSL comes with a default implementation of the RAND API which is
19       based on the deterministic random bit generator (DRBG) model as
20       described in [NIST SP 800-90A Rev. 1]. The default random generator
21       will initialize automatically on first use and will be fully functional
22       without having to be initialized ('seeded') explicitly.  It seeds and
23       reseeds itself automatically using trusted random sources provided by
24       the operating system.
25
26       As a normal application developer, you do not have to worry about any
27       details, just use RAND_bytes(3) to obtain random data.  Having said
28       that, there is one important rule to obey: Always check the error
29       return value of RAND_bytes(3) and do not take randomness for granted.
30       Although (re-)seeding is automatic, it can fail because no trusted
31       random source is available or the trusted source(s) temporarily fail to
32       provide sufficient random seed material.  In this case the CSPRNG
33       enters an error state and ceases to provide output, until it is able to
34       recover from the error by reseeding itself.  For more details on
35       reseeding and error recovery, see RAND_DRBG(7).
36
37       For values that should remain secret, you can use RAND_priv_bytes(3)
38       instead.  This method does not provide 'better' randomness, it uses the
39       same type of CSPRNG.  The intention behind using a dedicated CSPRNG
40       exclusively for private values is that none of its output should be
41       visible to an attacker (e.g., used as salt value), in order to reveal
42       as little information as possible about its internal state, and that a
43       compromise of the "public" CSPRNG instance will not affect the secrecy
44       of these private values.
45
46       In the rare case where the default implementation does not satisfy your
47       special requirements, there are two options:
48
49       · Replace the default RAND method by your own RAND method using
50         RAND_set_rand_method(3).
51
52       · Modify the default settings of the OpenSSL RAND method by modifying
53         the security parameters of the underlying DRBG, which is described in
54         detail in RAND_DRBG(7).
55
56       Changing the default random generator or its default parameters should
57       be necessary only in exceptional cases and is not recommended, unless
58       you have a profound knowledge of cryptographic principles and
59       understand the implications of your changes.
60

SEE ALSO

62       RAND_add(3), RAND_bytes(3), RAND_priv_bytes(3),
63       RAND_get_rand_method(3), RAND_set_rand_method(3), RAND_OpenSSL(3),
64       RAND_DRBG(7)
65
67       Copyright 2018-2019 The OpenSSL Project Authors. All Rights Reserved.
68
69       Licensed under the OpenSSL license (the "License").  You may not use
70       this file except in compliance with the License.  You can obtain a copy
71       in the file LICENSE in the source distribution or at
72       <https://www.openssl.org/source/license.html>.
73
74
75
761.1.1g                            2020-04-23                           RAND(7)
Impressum