diff options
Diffstat (limited to 'src/lib/libcrypto/doc/RAND_add.pod')
| -rw-r--r-- | src/lib/libcrypto/doc/RAND_add.pod | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/lib/libcrypto/doc/RAND_add.pod b/src/lib/libcrypto/doc/RAND_add.pod new file mode 100644 index 0000000000..0a13ec2a92 --- /dev/null +++ b/src/lib/libcrypto/doc/RAND_add.pod | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | =pod | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | RAND_add, RAND_seed, RAND_screen - add entropy to the PRNG | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | #include <openssl/rand.h> | ||
| 10 | |||
| 11 | void RAND_seed(const void *buf, int num); | ||
| 12 | |||
| 13 | void RAND_add(const void *buf, int num, double entropy); | ||
| 14 | |||
| 15 | int RAND_status(void); | ||
| 16 | |||
| 17 | void RAND_screen(void); | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | RAND_add() mixes the B<num> bytes at B<buf> into the PRNG state. Thus, | ||
| 22 | if the data at B<buf> are unpredictable to an adversary, this | ||
| 23 | increases the uncertainty about the state and makes the PRNG output | ||
| 24 | less predictable. Suitable input comes from user interaction (random | ||
| 25 | key presses, mouse movements) and certain hardware events. The | ||
| 26 | B<entropy> argument is (the lower bound of) an estimate of how much | ||
| 27 | randomness is contained in B<buf>, measured in bytes. Details about | ||
| 28 | sources of randomness and how to estimate their entropy can be found | ||
| 29 | in the literature, e.g. RFC 1750. | ||
| 30 | |||
| 31 | RAND_add() may be called with sensitive data such as user entered | ||
| 32 | passwords. The seed values cannot be recovered from the PRNG output. | ||
| 33 | |||
| 34 | OpenSSL makes sure that the PRNG state is unique for each thread. On | ||
| 35 | systems that provide C</dev/urandom>, the randomness device is used | ||
| 36 | to seed the PRNG transparently. However, on all other systems, the | ||
| 37 | application is responsible for seeding the PRNG by calling RAND_add(), | ||
| 38 | L<RAND_egd(3)|RAND_egd(3)> | ||
| 39 | or L<RAND_load_file(3)|RAND_load_file(3)>. | ||
| 40 | |||
| 41 | RAND_seed() is equivalent to RAND_add() when B<num == entropy>. | ||
| 42 | |||
| 43 | The RAND_screen() function is available for the convenience of Windows | ||
| 44 | programmers. It adds the current contents of the screen to the PRNG. | ||
| 45 | For applications that can catch Windows events, seeding the PRNG with | ||
| 46 | the parameters of B<WM_MOUSEMOVE> events is a significantly better | ||
| 47 | source of randomness. It should be noted that both methods cannot be | ||
| 48 | used on servers that run without user interaction. | ||
| 49 | |||
| 50 | =head1 RETURN VALUES | ||
| 51 | |||
| 52 | RAND_status() returns 1 if the PRNG has been seeded with enough data, | ||
| 53 | 0 otherwise. | ||
| 54 | |||
| 55 | The other functions do not return values. | ||
| 56 | |||
| 57 | =head1 SEE ALSO | ||
| 58 | |||
| 59 | L<rand(3)|rand(3)>, L<RAND_egd(3)|RAND_egd(3)>, | ||
| 60 | L<RAND_load_file(3)|RAND_load_file(3)>, L<RAND_cleanup(3)|RAND_cleanup(3)> | ||
| 61 | |||
| 62 | =head1 HISTORY | ||
| 63 | |||
| 64 | RAND_seed() and RAND_screen() are available in all versions of SSLeay | ||
| 65 | and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL | ||
| 66 | 0.9.5. | ||
| 67 | |||
| 68 | =cut | ||
