Commit | Line | Data |
---|---|---|
6f52b16c | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
607ca46e DH |
2 | /* |
3 | * include/linux/random.h | |
4 | * | |
5 | * Include file for the random number generator. | |
6 | */ | |
7 | ||
8 | #ifndef _UAPI_LINUX_RANDOM_H | |
9 | #define _UAPI_LINUX_RANDOM_H | |
10 | ||
11 | #include <linux/types.h> | |
12 | #include <linux/ioctl.h> | |
13 | #include <linux/irqnr.h> | |
14 | ||
15 | /* ioctl()'s for the random number generator */ | |
16 | ||
17 | /* Get the entropy count. */ | |
18 | #define RNDGETENTCNT _IOR( 'R', 0x00, int ) | |
19 | ||
20 | /* Add to (or subtract from) the entropy count. (Superuser only.) */ | |
21 | #define RNDADDTOENTCNT _IOW( 'R', 0x01, int ) | |
22 | ||
23 | /* Get the contents of the entropy pool. (Superuser only.) */ | |
24 | #define RNDGETPOOL _IOR( 'R', 0x02, int [2] ) | |
25 | ||
26 | /* | |
27 | * Write bytes into the entropy pool and add to the entropy count. | |
28 | * (Superuser only.) | |
29 | */ | |
30 | #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] ) | |
31 | ||
32 | /* Clear entropy count to 0. (Superuser only.) */ | |
33 | #define RNDZAPENTCNT _IO( 'R', 0x04 ) | |
34 | ||
35 | /* Clear the entropy pool and associated counters. (Superuser only.) */ | |
36 | #define RNDCLEARPOOL _IO( 'R', 0x06 ) | |
37 | ||
d848e5f8 TT |
38 | /* Reseed CRNG. (Superuser only.) */ |
39 | #define RNDRESEEDCRNG _IO( 'R', 0x07 ) | |
40 | ||
607ca46e DH |
41 | struct rand_pool_info { |
42 | int entropy_count; | |
43 | int buf_size; | |
94dfc73e | 44 | __u32 buf[]; |
607ca46e DH |
45 | }; |
46 | ||
c6e9d6f3 TT |
47 | /* |
48 | * Flags for getrandom(2) | |
49 | * | |
50 | * GRND_NONBLOCK Don't block and return EAGAIN instead | |
48446f19 | 51 | * GRND_RANDOM No effect |
75551dbf | 52 | * GRND_INSECURE Return non-cryptographic random bytes |
c6e9d6f3 TT |
53 | */ |
54 | #define GRND_NONBLOCK 0x0001 | |
55 | #define GRND_RANDOM 0x0002 | |
75551dbf | 56 | #define GRND_INSECURE 0x0004 |
c6e9d6f3 | 57 | |
607ca46e | 58 | #endif /* _UAPI_LINUX_RANDOM_H */ |