package/grub: only disable graphics on host grub
[openwrt/staging/wigyori.git] / target / linux / generic-2.6 / patches-2.6.25 / 971-ocf_20080917.patch
1 --- a/crypto/Kconfig
2 +++ b/crypto/Kconfig
3 @@ -593,3 +593,6 @@ config CRYPTO_LZO
4 source "drivers/crypto/Kconfig"
5
6 endif # if CRYPTO
7 +
8 +source "crypto/ocf/Kconfig"
9 +
10 --- a/crypto/Makefile
11 +++ b/crypto/Makefile
12 @@ -65,6 +65,8 @@ obj-$(CONFIG_CRYPTO_LZO) += lzo.o
13
14 obj-$(CONFIG_CRYPTO_TEST) += tcrypt.o
15
16 +obj-$(CONFIG_OCF_OCF) += ocf/
17 +
18 #
19 # generic algorithms and the async_tx api
20 #
21 --- a/drivers/char/random.c
22 +++ b/drivers/char/random.c
23 @@ -129,6 +129,9 @@
24 * unsigned int value);
25 * void add_interrupt_randomness(int irq);
26 *
27 + * void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
28 + * int random_input_wait(void);
29 + *
30 * add_input_randomness() uses the input layer interrupt timing, as well as
31 * the event type information from the hardware.
32 *
33 @@ -140,6 +143,13 @@
34 * a better measure, since the timing of the disk interrupts are more
35 * unpredictable.
36 *
37 + * random_input_words() just provides a raw block of entropy to the input
38 + * pool, such as from a hardware entropy generator.
39 + *
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.
43 + *
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
48 }
49 #endif
50
51 +/*
52 + * random_input_words - add bulk entropy to pool
53 + *
54 + * @buf: buffer to add
55 + * @wordcount: number of __u32 words to add
56 + * @ent_count: total amount of entropy (in bits) to credit
57 + *
58 + * this provides bulk input of entropy to the input pool
59 + *
60 + */
61 +void random_input_words(__u32 *buf, size_t wordcount, int ent_count)
62 +{
63 + add_entropy_words(&input_pool, buf, wordcount);
64 +
65 + credit_entropy_store(&input_pool, ent_count);
66 +
67 + DEBUG_ENT("crediting %d bits => %d\n",
68 + ent_count, input_pool.entropy_count);
69 + /*
70 + * Wake up waiting processes if we have enough
71 + * entropy.
72 + */
73 + if (input_pool.entropy_count >= random_read_wakeup_thresh)
74 + wake_up_interruptible(&random_read_wait);
75 +}
76 +EXPORT_SYMBOL(random_input_words);
77 +
78 +/*
79 + * random_input_wait - wait until random needs entropy
80 + *
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.
84 + */
85 +int random_input_wait(void)
86 +{
87 + int count;
88 +
89 + wait_event_interruptible(random_write_wait,
90 + input_pool.entropy_count < random_write_wakeup_thresh);
91 +
92 + count = random_write_wakeup_thresh - input_pool.entropy_count;
93 +
94 + /* likely we got woken up due to a signal */
95 + if (count <= 0) count = random_read_wakeup_thresh;
96 +
97 + DEBUG_ENT("requesting %d bits from input_wait()er %d<%d\n",
98 + count,
99 + input_pool.entropy_count, random_write_wakeup_thresh);
100 +
101 + return count;
102 +}
103 +EXPORT_SYMBOL(random_input_wait);
104 +
105 +
106 #define EXTRACT_SIZE 10
107
108 /*********************************************************************
109 --- a/fs/fcntl.c
110 +++ b/fs/fcntl.c
111 @@ -202,6 +202,7 @@ asmlinkage long sys_dup(unsigned int fil
112 ret = dupfd(file, 0, 0);
113 return ret;
114 }
115 +EXPORT_SYMBOL(sys_dup);
116
117 #define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | FASYNC | O_DIRECT | O_NOATIME)
118
119 --- a/include/linux/miscdevice.h
120 +++ b/include/linux/miscdevice.h
121 @@ -12,6 +12,7 @@
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
131 @@ -8,6 +8,7 @@
132 #define _LINUX_RANDOM_H
133
134 #include <linux/ioctl.h>
135 +#include <linux/types.h> /* for __u32 in user space */
136
137 /* ioctl()'s for the random number generator */
138
139 @@ -32,6 +33,30 @@
140 /* Clear the entropy pool and associated counters. (Superuser only.) */
141 #define RNDCLEARPOOL _IO( 'R', 0x06 )
142
143 +#ifdef CONFIG_FIPS_RNG
144 +
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
150 +
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 */
157 +};
158 +
159 +/* FIPS 140-2 RNG Variable Seed Test. (Superuser only.) */
160 +#define RNDFIPSVST _IOWR('R', 0x10, struct rand_fips_test)
161 +
162 +/* FIPS 140-2 RNG Monte Carlo Test. (Superuser only.) */
163 +#define RNDFIPSMCT _IOWR('R', 0x11, struct rand_fips_test)
164 +
165 +#endif /* #ifdef CONFIG_FIPS_RNG */
166 +
167 struct rand_pool_info {
168 int entropy_count;
169 int buf_size;
170 @@ -48,6 +73,10 @@ extern void add_input_randomness(unsigne
171 unsigned int value);
172 extern void add_interrupt_randomness(int irq);
173
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
177 +
178 extern void get_random_bytes(void *buf, int nbytes);
179 void generate_random_uuid(unsigned char uuid_out[16]);
180