RAND_add.pod 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. =pod
  2. =head1 NAME
  3. RAND_add, RAND_poll, RAND_seed, RAND_status, RAND_event, RAND_screen
  4. - add randomness to the PRNG or get its status
  5. =head1 SYNOPSIS
  6. #include <openssl/rand.h>
  7. int RAND_status(void);
  8. int RAND_poll();
  9. void RAND_add(const void *buf, int num, double randomness);
  10. void RAND_seed(const void *buf, int num);
  11. Deprecated:
  12. #if OPENSSL_API_COMPAT < 0x10100000L
  13. int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
  14. void RAND_screen(void);
  15. #endif
  16. =head1 DESCRIPTION
  17. These functions can be used to seed the random generator and to check its
  18. seeded state.
  19. In general, manual (re-)seeding of the default OpenSSL random generator
  20. (L<RAND_OpenSSL(3)>) is not necessary (but allowed), since it does (re-)seed
  21. itself automatically using trusted system entropy sources.
  22. This holds unless the default RAND_METHOD has been replaced or OpenSSL was
  23. built with automatic reseeding disabled, see L<RAND(7)> for more details.
  24. RAND_status() indicates whether or not the random generator has been sufficiently
  25. seeded. If not, functions such as L<RAND_bytes(3)> will fail.
  26. RAND_poll() uses the system's capabilities to seed the random generator using
  27. random input obtained from polling various trusted entropy sources.
  28. The default choice of the entropy source can be modified at build time,
  29. see L<RAND(7)> for more details.
  30. RAND_add() mixes the B<num> bytes at B<buf> into the internal state
  31. of the random generator.
  32. This function will not normally be needed, as mentioned above.
  33. The B<randomness> argument is an estimate of how much randomness is
  34. contained in
  35. B<buf>, in bytes, and should be a number between zero and B<num>.
  36. Details about sources of randomness and how to estimate their randomness
  37. can be found in the literature; for example [NIST SP 800-90B].
  38. The content of B<buf> cannot be recovered from subsequent random generator output.
  39. Applications that intend to save and restore random state in an external file
  40. should consider using L<RAND_load_file(3)> instead.
  41. RAND_seed() is equivalent to RAND_add() with B<randomness> set to B<num>.
  42. RAND_event() and RAND_screen() are equivalent to RAND_poll() and exist
  43. for compatibility reasons only. See HISTORY section below.
  44. =head1 RETURN VALUES
  45. RAND_status() returns 1 if the random generator has been seeded
  46. with enough data, 0 otherwise.
  47. RAND_poll() returns 1 if it generated seed data, 0 otherwise.
  48. RAND_event() returns RAND_status().
  49. The other functions do not return values.
  50. =head1 HISTORY
  51. RAND_event() and RAND_screen() were deprecated in OpenSSL 1.1.0 and should
  52. not be used.
  53. =head1 SEE ALSO
  54. L<RAND_bytes(3)>,
  55. L<RAND_egd(3)>,
  56. L<RAND_load_file(3)>,
  57. L<RAND(7)>
  58. =head1 COPYRIGHT
  59. Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
  60. Licensed under the OpenSSL license (the "License"). You may not use
  61. this file except in compliance with the License. You can obtain a copy
  62. in the file LICENSE in the source distribution or at
  63. L<https://www.openssl.org/source/license.html>.
  64. =cut