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