random.h 1.2 KB

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