1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux 1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 2 /* 3 * include/linux/random.h 3 * include/linux/random.h 4 * 4 * 5 * Include file for the random number generato 5 * Include file for the random number generator. 6 */ 6 */ 7 7 8 #ifndef _UAPI_LINUX_RANDOM_H 8 #ifndef _UAPI_LINUX_RANDOM_H 9 #define _UAPI_LINUX_RANDOM_H 9 #define _UAPI_LINUX_RANDOM_H 10 10 11 #include <linux/types.h> 11 #include <linux/types.h> 12 #include <linux/ioctl.h> 12 #include <linux/ioctl.h> 13 #include <linux/irqnr.h> 13 #include <linux/irqnr.h> 14 14 15 /* ioctl()'s for the random number generator * 15 /* ioctl()'s for the random number generator */ 16 16 17 /* Get the entropy count. */ 17 /* Get the entropy count. */ 18 #define RNDGETENTCNT _IOR( 'R', 0x00, int ) 18 #define RNDGETENTCNT _IOR( 'R', 0x00, int ) 19 19 20 /* Add to (or subtract from) the entropy count 20 /* Add to (or subtract from) the entropy count. (Superuser only.) */ 21 #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) 21 #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) 22 22 23 /* Get the contents of the entropy pool. (Sup 23 /* Get the contents of the entropy pool. (Superuser only.) (Removed in 2.6.9-rc2.) */ 24 #define RNDGETPOOL _IOR( 'R', 0x02, int [ 24 #define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) 25 25 26 /* 26 /* 27 * Write bytes into the entropy pool and add t 27 * Write bytes into the entropy pool and add to the entropy count. 28 * (Superuser only.) 28 * (Superuser only.) 29 */ 29 */ 30 #define RNDADDENTROPY _IOW( 'R', 0x03, int [ 30 #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) 31 31 32 /* Clear entropy count to 0. (Superuser only. 32 /* Clear entropy count to 0. (Superuser only.) */ 33 #define RNDZAPENTCNT _IO( 'R', 0x04 ) 33 #define RNDZAPENTCNT _IO( 'R', 0x04 ) 34 34 35 /* Clear the entropy pool and associated count 35 /* Clear the entropy pool and associated counters. (Superuser only.) */ 36 #define RNDCLEARPOOL _IO( 'R', 0x06 ) 36 #define RNDCLEARPOOL _IO( 'R', 0x06 ) 37 37 38 /* Reseed CRNG. (Superuser only.) */ 38 /* Reseed CRNG. (Superuser only.) */ 39 #define RNDRESEEDCRNG _IO( 'R', 0x07 ) 39 #define RNDRESEEDCRNG _IO( 'R', 0x07 ) 40 40 41 struct rand_pool_info { 41 struct rand_pool_info { 42 int entropy_count; 42 int entropy_count; 43 int buf_size; 43 int buf_size; 44 __u32 buf[]; 44 __u32 buf[]; 45 }; 45 }; 46 46 47 /* 47 /* 48 * Flags for getrandom(2) 48 * Flags for getrandom(2) 49 * 49 * 50 * GRND_NONBLOCK Don't block and return 50 * GRND_NONBLOCK Don't block and return EAGAIN instead 51 * GRND_RANDOM No effect 51 * GRND_RANDOM No effect 52 * GRND_INSECURE Return non-cryptograph 52 * GRND_INSECURE Return non-cryptographic random bytes 53 */ 53 */ 54 #define GRND_NONBLOCK 0x0001 54 #define GRND_NONBLOCK 0x0001 55 #define GRND_RANDOM 0x0002 55 #define GRND_RANDOM 0x0002 56 #define GRND_INSECURE 0x0004 56 #define GRND_INSECURE 0x0004 57 57 58 /** 58 /** 59 * struct vgetrandom_opaque_params - arguments 59 * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom 60 * 60 * 61 * @size_per_opaque_state: Size of each s 61 * @size_per_opaque_state: Size of each state that is to be passed to vgetrandom(). 62 * @mmap_prot: Value of the p 62 * @mmap_prot: Value of the prot argument in mmap(2). 63 * @mmap_flags: Value of the f 63 * @mmap_flags: Value of the flags argument in mmap(2). 64 * @reserved: Reserved for f 64 * @reserved: Reserved for future use. 65 */ 65 */ 66 struct vgetrandom_opaque_params { 66 struct vgetrandom_opaque_params { 67 __u32 size_of_opaque_state; 67 __u32 size_of_opaque_state; 68 __u32 mmap_prot; 68 __u32 mmap_prot; 69 __u32 mmap_flags; 69 __u32 mmap_flags; 70 __u32 reserved[13]; 70 __u32 reserved[13]; 71 }; 71 }; 72 72 73 #endif /* _UAPI_LINUX_RANDOM_H */ 73 #endif /* _UAPI_LINUX_RANDOM_H */ 74 74
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.