]>
Commit | Line | Data |
---|---|---|
4ec2d4d2 UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
aafbe1cc | 5 | RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon |
4ec2d4d2 UM |
6 | |
7 | =head1 SYNOPSIS | |
8 | ||
9 | #include <openssl/rand.h> | |
10 | ||
04256277 | 11 | int RAND_egd_bytes(const char *path, int num); |
4ec2d4d2 | 12 | int RAND_egd(const char *path); |
420125f9 | 13 | |
04256277 | 14 | int RAND_query_egd_bytes(const char *path, unsigned char *buf, int num); |
4ec2d4d2 UM |
15 | |
16 | =head1 DESCRIPTION | |
17 | ||
04256277 RS |
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 | |
e0c89df9 | 29 | the specified socket B<path>, where B<num> must be less than 256. |
04256277 RS |
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. | |
466e4249 | 36 | |
1f13ad31 | 37 | =head1 RETURN VALUES |
4ec2d4d2 | 38 | |
420125f9 | 39 | RAND_egd() and RAND_egd_bytes() return the number of bytes read from the |
04256277 | 40 | daemon on success, or -1 if the connection failed or the daemon did not |
420125f9 LJ |
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 | |
04256277 | 44 | success, or -1 if the connection failed. |
4ec2d4d2 UM |
45 | |
46 | =head1 SEE ALSO | |
47 | ||
a73d990e DMSP |
48 | L<RAND_add(3)>, |
49 | L<RAND_bytes(3)>, | |
50 | L<RAND(7)> | |
4ec2d4d2 | 51 | |
e2f92610 RS |
52 | =head1 COPYRIGHT |
53 | ||
61f805c1 | 54 | Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved. |
e2f92610 | 55 | |
4746f25a | 56 | Licensed under the Apache License 2.0 (the "License"). You may not use |
e2f92610 RS |
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 |