random.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * @file random.h
  3. * @brief Random number generator
  4. * @copyright (c) 2010-2011, Jouni Malinen <j@w1.fi>
  5. *
  6. *
  7. * @note This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * @note Alternatively, this software may be distributed under the terms of BSD
  12. * license.
  13. *
  14. * @note See README and COPYING for more details.
  15. */
  16. #ifndef RANDOM_H
  17. #define RANDOM_H
  18. /**
  19. * @brief This function is used to add number to random pool
  20. *
  21. * @param[in] *buf number to add
  22. * @param[in] len number count
  23. *
  24. * @return None
  25. *
  26. * @note None
  27. */
  28. void random_add_randomness(const void *buf, size_t len);
  29. /**
  30. * @brief This function is used to get random number with len from
  31. random pool
  32. *
  33. * @param[in] *buf used to save random number
  34. * @param[in] len length of random number
  35. *
  36. * @retval 0 success
  37. * @retval other failed
  38. *
  39. * @note None
  40. */
  41. int random_get_bytes(void *buf, size_t len);
  42. #define random_mark_pool_ready() do { } while (0)
  43. /** random pool ready */
  44. #define random_pool_ready() 1
  45. #endif /* RANDOM_H */