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