random.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /*
  3. * include/linux/random.h
  4. *
  5. * Include file for the random number generator.
  6. */
  7. #ifndef _UAPI_LINUX_RANDOM_H
  8. #define _UAPI_LINUX_RANDOM_H
  9. #include <linux/types.h>
  10. #include <linux/ioctl.h>
  11. #include <linux/irqnr.h>
  12. /* ioctl()'s for the random number generator */
  13. /* Get the entropy count. */
  14. #define RNDGETENTCNT _IOR( 'R', 0x00, int )
  15. /* Add to (or subtract from) the entropy count. (Superuser only.) */
  16. #define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
  17. /* Get the contents of the entropy pool. (Superuser only.) */
  18. #define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
  19. /*
  20. * Write bytes into the entropy pool and add to the entropy count.
  21. * (Superuser only.)
  22. */
  23. #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
  24. /* Clear entropy count to 0. (Superuser only.) */
  25. #define RNDZAPENTCNT _IO( 'R', 0x04 )
  26. /* Clear the entropy pool and associated counters. (Superuser only.) */
  27. #define RNDCLEARPOOL _IO( 'R', 0x06 )
  28. struct rand_pool_info {
  29. int entropy_count;
  30. int buf_size;
  31. __u32 buf[0];
  32. };
  33. /*
  34. * Flags for getrandom(2)
  35. *
  36. * GRND_NONBLOCK Don't block and return EAGAIN instead
  37. * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom
  38. */
  39. #define GRND_NONBLOCK 0x0001
  40. #define GRND_RANDOM 0x0002
  41. #endif /* _UAPI_LINUX_RANDOM_H */