1 | =pod
|
---|
2 |
|
---|
3 | =head1 NAME
|
---|
4 |
|
---|
5 | RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon
|
---|
6 |
|
---|
7 | =head1 SYNOPSIS
|
---|
8 |
|
---|
9 | #include <openssl/rand.h>
|
---|
10 |
|
---|
11 | int RAND_egd_bytes(const char *path, int num);
|
---|
12 | int RAND_egd(const char *path);
|
---|
13 |
|
---|
14 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);
|
---|
15 |
|
---|
16 | =head1 DESCRIPTION
|
---|
17 |
|
---|
18 | On older platforms without a good source of randomness such as C</dev/urandom>,
|
---|
19 | it is possible to query an Entropy Gathering Daemon (EGD) over a local
|
---|
20 | socket to obtain randomness and seed the OpenSSL RNG.
|
---|
21 | The protocol used is defined by the EGDs available at
|
---|
22 | L<http://egd.sourceforge.net/> or L<http://prngd.sourceforge.net>.
|
---|
23 |
|
---|
24 | RAND_egd_bytes() requests B<num> bytes of randomness from an EGD at the
|
---|
25 | specified socket B<path>, and passes the data it receives into RAND_add().
|
---|
26 | RAND_egd() is equivalent to RAND_egd_bytes() with B<num> set to 255.
|
---|
27 |
|
---|
28 | RAND_query_egd_bytes() requests B<num> bytes of randomness from an EGD at
|
---|
29 | the specified socket B<path>, where B<num> must be less than 256.
|
---|
30 | If B<buf> is B<NULL>, it is equivalent to RAND_egd_bytes().
|
---|
31 | If B<buf> is not B<NULL>, then the data is copied to the buffer and
|
---|
32 | RAND_add() is not called.
|
---|
33 |
|
---|
34 | OpenSSL can be configured at build time to try to use the EGD for seeding
|
---|
35 | automatically.
|
---|
36 |
|
---|
37 | =head1 RETURN VALUES
|
---|
38 |
|
---|
39 | RAND_egd() and RAND_egd_bytes() return the number of bytes read from the
|
---|
40 | daemon on success, or -1 if the connection failed or the daemon did not
|
---|
41 | return enough data to fully seed the PRNG.
|
---|
42 |
|
---|
43 | RAND_query_egd_bytes() returns the number of bytes read from the daemon on
|
---|
44 | success, or -1 if the connection failed.
|
---|
45 |
|
---|
46 | =head1 SEE ALSO
|
---|
47 |
|
---|
48 | L<RAND_add(3)>,
|
---|
49 | L<RAND_bytes(3)>,
|
---|
50 | L<RAND(7)>
|
---|
51 |
|
---|
52 | =head1 COPYRIGHT
|
---|
53 |
|
---|
54 | Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
|
---|
55 |
|
---|
56 | Licensed under the OpenSSL license (the "License"). You may not use
|
---|
57 | this file except in compliance with the License. You can obtain a copy
|
---|
58 | in the file LICENSE in the source distribution or at
|
---|
59 | L<https://www.openssl.org/source/license.html>.
|
---|
60 |
|
---|
61 | =cut
|
---|