random.h 942 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* Copyright (C) 2015 Bernhard Reutner-Fischer
  2. * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  3. */
  4. #ifndef _SYS_RANDOM_H
  5. #define _SYS_RANDOM_H 1
  6. #include <features.h>
  7. #include <stddef.h>
  8. __BEGIN_DECLS
  9. #if defined __UCLIBC_LINUX_SPECIFIC__
  10. # if 0 /*def __ASSUME_GETRANDOM_SYSCALL */
  11. # include <linux/random.h>
  12. # else
  13. # undef GRND_NONBLOCK
  14. # undef GRND_RANDOM
  15. /*
  16. * Flags for getrandom(2)
  17. *
  18. * GRND_NONBLOCK Don't block and return EAGAIN instead
  19. * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
  20. * GRND_INSECURE Write random data that may not be cryptographically secure.
  21. */
  22. # define GRND_NONBLOCK 0x0001
  23. # define GRND_RANDOM 0x0002
  24. # define GRND_INSECURE 0x0004
  25. # endif
  26. /* FIXME: aren't there a couple of __restrict and const missing ? */
  27. extern int getrandom(void *__buf, size_t count, unsigned int flags)
  28. __nonnull ((1)) __wur;
  29. #endif
  30. __END_DECLS
  31. #endif /* sys/random.h */