2000-02-24 02:51:47 +00:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2013-06-12 22:42:08 +00:00
|
|
|
RAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon
|
2000-02-24 02:51:47 +00:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/rand.h>
|
|
|
|
|
2017-07-07 20:47:39 +00:00
|
|
|
int RAND_egd_bytes(const char *path, int num);
|
2000-02-24 02:51:47 +00:00
|
|
|
int RAND_egd(const char *path);
|
2001-02-08 10:42:01 +00:00
|
|
|
|
2017-07-07 20:47:39 +00:00
|
|
|
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);
|
2000-02-24 02:51:47 +00:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2017-07-07 20:47:39 +00:00
|
|
|
On older platforms without a good source of randomness such as C</dev/urandom>,
|
|
|
|
it is possible to query an Entropy Gathering Daemon (EGD) over a local
|
|
|
|
socket to obtain randomness and seed the OpenSSL RNG.
|
|
|
|
The protocol used is defined by the EGDs available at
|
|
|
|
L<http://egd.sourceforge.net/> or L<http://prngd.sourceforge.net>.
|
|
|
|
|
|
|
|
RAND_egd_bytes() requests B<num> bytes of randomness from an EGD at the
|
|
|
|
specified socket B<path>, and passes the data it receives into RAND_add().
|
|
|
|
RAND_egd() is equivalent to RAND_egd_bytes() with B<num> set to 255.
|
|
|
|
|
|
|
|
RAND_query_egd_bytes() requests B<num> bytes of randomness from an EGD at
|
2017-07-08 18:45:15 +00:00
|
|
|
the specified socket B<path>, where B<num> must be less than 256.
|
2017-07-07 20:47:39 +00:00
|
|
|
If B<buf> is B<NULL>, it is equivalent to RAND_egd_bytes().
|
|
|
|
If B<buf> is not B<NULL>, then the data is copied to the buffer and
|
|
|
|
RAND_add() is not called.
|
|
|
|
|
|
|
|
OpenSSL can be configured at build time to try to use the EGD for seeding
|
|
|
|
automatically.
|
2001-02-08 17:16:44 +00:00
|
|
|
|
2000-02-24 03:36:01 +00:00
|
|
|
=head1 RETURN VALUE
|
2000-02-24 02:51:47 +00:00
|
|
|
|
2001-02-08 10:42:01 +00:00
|
|
|
RAND_egd() and RAND_egd_bytes() return the number of bytes read from the
|
2017-07-07 20:47:39 +00:00
|
|
|
daemon on success, or -1 if the connection failed or the daemon did not
|
2001-02-08 10:42:01 +00:00
|
|
|
return enough data to fully seed the PRNG.
|
|
|
|
|
|
|
|
RAND_query_egd_bytes() returns the number of bytes read from the daemon on
|
2017-07-07 20:47:39 +00:00
|
|
|
success, or -1 if the connection failed.
|
2000-02-24 02:51:47 +00:00
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2017-07-07 20:47:39 +00:00
|
|
|
L<RAND_bytes(3)>, L<RAND_add(3)>
|
2000-02-24 02:51:47 +00:00
|
|
|
|
2016-05-18 15:44:05 +00:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2017-07-07 20:47:39 +00:00
|
|
|
Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
|
2016-05-18 15:44:05 +00:00
|
|
|
|
|
|
|
Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|