Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firewire-audio.git] / include / linux / random.h
blob407ea3646f8f12f05a0410166f3ff2e6fa4a447e
1 /*
2 * include/linux/random.h
4 * Include file for the random number generator.
5 */
7 #ifndef _LINUX_RANDOM_H
8 #define _LINUX_RANDOM_H
10 #include <linux/ioctl.h>
11 #include <linux/irqnr.h>
13 /* ioctl()'s for the random number generator */
15 /* Get the entropy count. */
16 #define RNDGETENTCNT _IOR( 'R', 0x00, int )
18 /* Add to (or subtract from) the entropy count. (Superuser only.) */
19 #define RNDADDTOENTCNT _IOW( 'R', 0x01, int )
21 /* Get the contents of the entropy pool. (Superuser only.) */
22 #define RNDGETPOOL _IOR( 'R', 0x02, int [2] )
24 /*
25 * Write bytes into the entropy pool and add to the entropy count.
26 * (Superuser only.)
28 #define RNDADDENTROPY _IOW( 'R', 0x03, int [2] )
30 /* Clear entropy count to 0. (Superuser only.) */
31 #define RNDZAPENTCNT _IO( 'R', 0x04 )
33 /* Clear the entropy pool and associated counters. (Superuser only.) */
34 #define RNDCLEARPOOL _IO( 'R', 0x06 )
36 struct rand_pool_info {
37 int entropy_count;
38 int buf_size;
39 __u32 buf[0];
42 /* Exported functions */
44 #ifdef __KERNEL__
46 extern void rand_initialize_irq(int irq);
48 extern void add_input_randomness(unsigned int type, unsigned int code,
49 unsigned int value);
50 extern void add_interrupt_randomness(int irq);
52 extern void get_random_bytes(void *buf, int nbytes);
53 void generate_random_uuid(unsigned char uuid_out[16]);
55 extern __u32 secure_ip_id(__be32 daddr);
56 extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
57 extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
58 __be16 dport);
59 extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
60 __be16 sport, __be16 dport);
61 extern __u32 secure_tcpv6_sequence_number(__be32 *saddr, __be32 *daddr,
62 __be16 sport, __be16 dport);
63 extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
64 __be16 sport, __be16 dport);
66 #ifndef MODULE
67 extern const struct file_operations random_fops, urandom_fops;
68 #endif
70 unsigned int get_random_int(void);
71 unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
73 u32 random32(void);
74 void srandom32(u32 seed);
76 #endif /* __KERNEL___ */
78 #endif /* _LINUX_RANDOM_H */