3 @@ -593,3 +593,6 @@ config CRYPTO_LZO
4 source "drivers/crypto/Kconfig"
8 +source "crypto/ocf/Kconfig"
12 @@ -65,6 +65,8 @@ obj-$(CONFIG_CRYPTO_LZO) += lzo.o
14 obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
16 +obj-$(CONFIG_OCF_OCF) += ocf/
19 # generic algorithms and the async_tx api
21 --- a/drivers/char/random.c
22 +++ b/drivers/char/random.c
24 * unsigned int value);
25 * void add_interrupt_randomness(int irq);
27 + * void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
28 + * int random_input_wait(void);
30 * add_input_randomness() uses the input layer interrupt timing, as well as
31 * the event type information from the hardware.
34 * a better measure, since the timing of the disk interrupts are more
37 + * random_input_words() just provides a raw block of entropy to the input
38 + * pool, such as from a hardware entropy generator.
40 + * random_input_wait() suspends the caller until such time as the
41 + * entropy pool falls below the write threshold, and returns a count of how
42 + * much entropy (in bits) is needed to sustain the pool.
44 * All of these routines try to estimate how many bits of randomness a
45 * particular randomness source. They do this by keeping track of the
46 * first and second order deltas of the event timings.
47 @@ -669,6 +679,61 @@ void add_disk_randomness(struct gendisk
52 + * random_input_words - add bulk entropy to pool
54 + * @buf: buffer to add
55 + * @wordcount: number of __u32 words to add
56 + * @ent_count: total amount of entropy (in bits) to credit
58 + * this provides bulk input of entropy to the input pool
61 +void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
63 + add_entropy_words(&input_pool, buf, wordcount);
65 + credit_entropy_store(&input_pool, ent_count);
67 + DEBUG_ENT("crediting %d bits => %d\n",
68 + ent_count, input_pool.entropy_count);
70 + * Wake up waiting processes if we have enough
73 + if (input_pool.entropy_count >= random_read_wakeup_thresh)
74 + wake_up_interruptible(&random_read_wait);
76 +EXPORT_SYMBOL(random_input_words);
79 + * random_input_wait - wait until random needs entropy
81 + * this function sleeps until the /dev/random subsystem actually
82 + * needs more entropy, and then return the amount of entropy
83 + * that it would be nice to have added to the system.
85 +int random_input_wait(void)
89 + wait_event_interruptible(random_write_wait,
90 + input_pool.entropy_count < random_write_wakeup_thresh);
92 + count = random_write_wakeup_thresh - input_pool.entropy_count;
94 + /* likely we got woken up due to a signal */
95 + if (count <= 0) count = random_read_wakeup_thresh;
97 + DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
99 + input_pool.entropy_count, random_write_wakeup_thresh);
103 +EXPORT_SYMBOL(random_input_wait);
106 #define EXTRACT_SIZE 10
108 /*********************************************************************
111 @@ -202,6 +202,7 @@ asmlinkage long sys_dup(unsigned int fil
112 ret = dupfd(file, 0, 0);
115 +EXPORT_SYMBOL(sys_dup);
117 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | FASYNC | O_DIRECT | O_NOATIME)
119 --- a/include/linux/miscdevice.h
120 +++ b/include/linux/miscdevice.h
122 #define APOLLO_MOUSE_MINOR 7
123 #define PC110PAD_MINOR 9
124 /*#define ADB_MOUSE_MINOR 10 FIXME OBSOLETE */
125 +#define CRYPTODEV_MINOR 70 /* /dev/crypto */
126 #define WATCHDOG_MINOR 130 /* Watchdog timer */
127 #define TEMP_MINOR 131 /* Temperature Sensor */
128 #define RTC_MINOR 135
129 --- a/include/linux/random.h
130 +++ b/include/linux/random.h
132 #define _LINUX_RANDOM_H
134 #include <linux/ioctl.h>
135 +#include <linux/types.h> /* for __u32 in user space */
137 /* ioctl()'s for the random number generator */
140 /* Clear the entropy pool and associated counters. (Superuser only.) */
141 #define RNDCLEARPOOL _IO( 'R', 0x06 )
143 +#ifdef CONFIG_FIPS_RNG
145 +/* Size of seed value - equal to AES blocksize */
146 +#define AES_BLOCK_SIZE_BYTES 16
147 +#define SEED_SIZE_BYTES AES_BLOCK_SIZE_BYTES
148 +/* Size of AES key */
149 +#define KEY_SIZE_BYTES 16
151 +/* ioctl() structure used by FIPS 140-2 Tests */
152 +struct rand_fips_test {
153 + unsigned char key[KEY_SIZE_BYTES]; /* Input */
154 + unsigned char datetime[SEED_SIZE_BYTES]; /* Input */
155 + unsigned char seed[SEED_SIZE_BYTES]; /* Input */
156 + unsigned char result[SEED_SIZE_BYTES]; /* Output */
159 +/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */
160 +#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test)
162 +/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */
163 +#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test)
165 +#endif /* #ifdef CONFIG_FIPS_RNG */
167 struct rand_pool_info {
170 @@ -48,6 +73,10 @@ extern void add_input_randomness(unsigne
172 extern void add_interrupt_randomness(int irq);
174 +extern void random_input_words(__u32 *buf, size_t wordcount, int ent_count);
175 +extern int random_input_wait(void);
176 +#define HAS_RANDOM_INPUT_WAIT 1
178 extern void get_random_bytes(void *buf, int nbytes);
179 void generate_random_uuid(unsigned char uuid_out[16]);