1 --- a/drivers/char/random.c
2 +++ b/drivers/char/random.c
3 @@ -901,6 +901,65 @@ void add_blkdev_randomness(int major)
4 #define subRound(a, b, c, d, e, f, k, data) \
5 ( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )
8 + * random_input_words - add bulk entropy to pool
10 + * @buf: buffer to add
11 + * @wordcount: number of __u32 words to add
12 + * @ent_count: total amount of entropy (in bits) to credit
14 + * this provides bulk input of entropy to the input pool
17 +void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
21 + add_entropy_words(random_state, buf, wordcount);
23 + credit_entropy_store(random_state, ent_count);
25 + DEBUG_ENT("credited %d bits => %d\n",
26 + ent_count, random_state->entropy_count);
28 + * Wake up waiting processes if we have enough
31 + if (random_state->entropy_count >= random_read_wakeup_thresh)
32 + wake_up_interruptible(&random_read_wait);
34 +EXPORT_SYMBOL(random_input_words);
37 + * random_input_wait - wait until random needs entropy
39 + * this function sleeps until the /dev/random subsystem actually
40 + * needs more entropy, and then return the amount of entropy
41 + * that it would be nice to have added to the system.
43 +int random_input_wait(void)
50 + wait_event_interruptible(random_write_wait,
51 + random_state->entropy_count < random_write_wakeup_thresh);
53 + count = random_write_wakeup_thresh - random_state->entropy_count;
55 + /* likely we got woken up due to a signal */
56 + if (count <= 0) count = random_read_wakeup_thresh;
58 + DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
60 + random_state->entropy_count, random_write_wakeup_thresh);
64 +EXPORT_SYMBOL(random_input_wait);
67 static void SHATransform(__u32 digest[85], __u32 const data[16])
71 @@ -10,6 +10,8 @@ O_TARGET := fs.o
72 export-objs := filesystems.o open.o dcache.o buffer.o dquot.o
75 +export-objs += fcntl.o
77 obj-y := open.o read_write.o devices.o file_table.o buffer.o \
78 super.o block_dev.o char_dev.o stat.o exec.o pipe.o namei.o \
79 fcntl.o ioctl.o readdir.o select.o fifo.o locks.o \
83 #include <linux/slab.h>
84 #include <linux/iobuf.h>
85 #include <linux/ptrace.h>
86 +#include <linux/module.h>
89 #include <asm/siginfo.h>
90 @@ -199,6 +200,7 @@ asmlinkage long sys_dup(unsigned int fil
94 +EXPORT_SYMBOL(sys_dup);
96 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | FASYNC | O_DIRECT)
98 --- a/include/linux/miscdevice.h
99 +++ b/include/linux/miscdevice.h
101 #define ADB_MOUSE_MINOR 10
102 #define MK712_MINOR 15 /* MK712 touch screen */
103 #define SYNTH_MINOR 25
104 +#define CRYPTODEV_MINOR 70 /* OpenBSD cryptographic framework */
105 #define WATCHDOG_MINOR 130 /* Watchdog timer */
106 #define TEMP_MINOR 131 /* Temperature Sensor */
107 #define RTC_MINOR 135
108 --- a/include/linux/random.h
109 +++ b/include/linux/random.h
110 @@ -53,6 +53,10 @@ extern void add_mouse_randomness(__u32 m
111 extern void add_interrupt_randomness(int irq);
112 extern void add_blkdev_randomness(int major);
114 +extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count);
115 +extern int random_input_wait(void);
116 +#define HAS_RANDOM_INPUT_WAIT 1
118 extern void get_random_bytes(void *buf, int nbytes);
119 void generate_random_uuid(unsigned char uuid_out[16]);