You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rand.h 1.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #ifndef OPENSSL_HEADER_RAND_H
  15. #define OPENSSL_HEADER_RAND_H
  16. #include <openssl/base.h>
  17. #if defined(__cplusplus)
  18. extern "C" {
  19. #endif
  20. /* Random number generation. */
  21. /* RAND_bytes writes |len| bytes of random data to |buf| and returns one. */
  22. OPENSSL_EXPORT int RAND_bytes(uint8_t *buf, size_t len);
  23. /* RAND_cleanup frees any resources used by the RNG. This is not safe if other
  24. * threads might still be calling |RAND_bytes|. */
  25. OPENSSL_EXPORT void RAND_cleanup(void);
  26. /* Deprecated functions */
  27. /* RAND_pseudo_bytes is a wrapper around |RAND_bytes|. */
  28. OPENSSL_EXPORT int RAND_pseudo_bytes(uint8_t *buf, size_t len);
  29. /* RAND_seed does nothing. */
  30. OPENSSL_EXPORT void RAND_seed(const void *buf, int num);
  31. /* RAND_add does nothing. */
  32. OPENSSL_EXPORT void RAND_add(const void *buf, int num, double entropy);
  33. /* RAND_poll returns one. */
  34. OPENSSL_EXPORT int RAND_poll(void);
  35. /* RAND_status returns one. */
  36. OPENSSL_EXPORT int RAND_status(void);
  37. #if defined(__cplusplus)
  38. } /* extern C */
  39. #endif
  40. #endif /* OPENSSL_HEADER_RAND_H */