xref: /netbsd-src/crypto/external/bsd/openssl/dist/doc/man3/RAND_egd.pod (revision b0d1725196a7921d003d2c66a14f186abda4176b)
113d40330Schristos=pod
213d40330Schristos
313d40330Schristos=head1 NAME
413d40330Schristos
513d40330SchristosRAND_egd, RAND_egd_bytes, RAND_query_egd_bytes - query entropy gathering daemon
613d40330Schristos
713d40330Schristos=head1 SYNOPSIS
813d40330Schristos
913d40330Schristos #include <openssl/rand.h>
1013d40330Schristos
1113d40330Schristos int RAND_egd_bytes(const char *path, int num);
1213d40330Schristos int RAND_egd(const char *path);
1313d40330Schristos
1413d40330Schristos int RAND_query_egd_bytes(const char *path, unsigned char *buf, int num);
1513d40330Schristos
1613d40330Schristos=head1 DESCRIPTION
1713d40330Schristos
1813d40330SchristosOn older platforms without a good source of randomness such as C</dev/urandom>,
1913d40330Schristosit is possible to query an Entropy Gathering Daemon (EGD) over a local
2013d40330Schristossocket to obtain randomness and seed the OpenSSL RNG.
2113d40330SchristosThe protocol used is defined by the EGDs available at
2213d40330SchristosL<http://egd.sourceforge.net/> or L<http://prngd.sourceforge.net>.
2313d40330Schristos
2413d40330SchristosRAND_egd_bytes() requests B<num> bytes of randomness from an EGD at the
2513d40330Schristosspecified socket B<path>, and passes the data it receives into RAND_add().
2613d40330SchristosRAND_egd() is equivalent to RAND_egd_bytes() with B<num> set to 255.
2713d40330Schristos
2813d40330SchristosRAND_query_egd_bytes() requests B<num> bytes of randomness from an EGD at
2913d40330Schristosthe specified socket B<path>, where B<num> must be less than 256.
3013d40330SchristosIf B<buf> is B<NULL>, it is equivalent to RAND_egd_bytes().
3113d40330SchristosIf B<buf> is not B<NULL>, then the data is copied to the buffer and
3213d40330SchristosRAND_add() is not called.
3313d40330Schristos
3413d40330SchristosOpenSSL can be configured at build time to try to use the EGD for seeding
3513d40330Schristosautomatically.
3613d40330Schristos
3713d40330Schristos=head1 RETURN VALUES
3813d40330Schristos
3913d40330SchristosRAND_egd() and RAND_egd_bytes() return the number of bytes read from the
4013d40330Schristosdaemon on success, or -1 if the connection failed or the daemon did not
4113d40330Schristosreturn enough data to fully seed the PRNG.
4213d40330Schristos
4313d40330SchristosRAND_query_egd_bytes() returns the number of bytes read from the daemon on
4413d40330Schristossuccess, or -1 if the connection failed.
4513d40330Schristos
4613d40330Schristos=head1 SEE ALSO
4713d40330Schristos
4813d40330SchristosL<RAND_add(3)>,
4913d40330SchristosL<RAND_bytes(3)>,
5013d40330SchristosL<RAND(7)>
5113d40330Schristos
5213d40330Schristos=head1 COPYRIGHT
5313d40330Schristos
5413d40330SchristosCopyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
5513d40330Schristos
56*b0d17251SchristosLicensed under the Apache License 2.0 (the "License").  You may not use
5713d40330Schristosthis file except in compliance with the License.  You can obtain a copy
5813d40330Schristosin the file LICENSE in the source distribution or at
5913d40330SchristosL<https://www.openssl.org/source/license.html>.
6013d40330Schristos
6113d40330Schristos=cut
62