RAND_egd.pod 1.9 KB

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