RAND_add.pod 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. =pod
  2. =head1 NAME
  3. RAND_add, RAND_seed, RAND_status, RAND_event, RAND_screen - add
  4. entropy to the PRNG
  5. =head1 SYNOPSIS
  6. #include <openssl/rand.h>
  7. void RAND_seed(const void *buf, int num);
  8. void RAND_add(const void *buf, int num, double entropy);
  9. int RAND_status(void);
  10. #if OPENSSL_API_COMPAT < 0x10100000L
  11. int RAND_event(UINT iMsg, WPARAM wParam, LPARAM lParam);
  12. void RAND_screen(void);
  13. #endif
  14. =head1 DESCRIPTION
  15. RAND_add() mixes the B<num> bytes at B<buf> into the PRNG state. Thus,
  16. if the data at B<buf> are unpredictable to an adversary, this
  17. increases the uncertainty about the state and makes the PRNG output
  18. less predictable. Suitable input comes from user interaction (random
  19. key presses, mouse movements) and certain hardware events. The
  20. B<entropy> argument is (the lower bound of) an estimate of how much
  21. randomness is contained in B<buf>, measured in bytes. Details about
  22. sources of randomness and how to estimate their entropy can be found
  23. in the literature, e.g. RFC 1750.
  24. RAND_add() may be called with sensitive data such as user entered
  25. passwords. The seed values cannot be recovered from the PRNG output.
  26. OpenSSL makes sure that the PRNG state is unique for each thread. On
  27. systems that provide C</dev/urandom>, the randomness device is used
  28. to seed the PRNG transparently. However, on all other systems, the
  29. application is responsible for seeding the PRNG by calling RAND_add(),
  30. L<RAND_egd(3)>
  31. or L<RAND_load_file(3)>.
  32. RAND_seed() is equivalent to RAND_add() when B<num == entropy>.
  33. RAND_event() and RAND_screen() are deprecated and should not be called.
  34. =head1 RETURN VALUES
  35. RAND_status() returns 1 if the PRNG has been seeded
  36. with enough data, 0 otherwise.
  37. RAND_event() calls RAND_poll() and returns RAND_status().
  38. RAND_screen calls RAND_poll().
  39. The other functions do not return values.
  40. =head1 HISTORY
  41. RAND_event() and RAND_screen() are deprecated since OpenSSL
  42. 1.1.0. Use the functions described above instead.
  43. =head1 SEE ALSO
  44. L<rand(3)>, L<RAND_egd(3)>,
  45. L<RAND_load_file(3)>, L<RAND_cleanup(3)>
  46. =head1 COPYRIGHT
  47. Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
  48. Licensed under the OpenSSL license (the "License"). You may not use
  49. this file except in compliance with the License. You can obtain a copy
  50. in the file LICENSE in the source distribution or at
  51. L<https://www.openssl.org/source/license.html>.
  52. =cut