patch-1.3.54 linux/drivers/char/random.c
Next file: linux/drivers/net/lance.c
Previous file: linux/drivers/block/rd.c
Back to the patch index
Back to the overall index
- Lines: 44
- Date:
Wed Jan 3 14:04:53 1996
- Orig file:
v1.3.53/linux/drivers/char/random.c
- Orig date:
Thu Nov 9 11:23:48 1995
diff -u --recursive --new-file v1.3.53/linux/drivers/char/random.c linux/drivers/char/random.c
@@ -1,7 +1,7 @@
/*
* random.c -- A strong random number generator
*
- * Version 0.95, last modified 4-Nov-95
+ * Version 0.96, last modified 29-Dec-95
*
* Copyright Theodore Ts'o, 1994, 1995. All rights reserved.
*
@@ -276,7 +276,7 @@
}
}
-void rand_initialize_blkdev(int major)
+void rand_initialize_blkdev(int major, int mode)
{
struct timer_rand_state *state;
@@ -287,7 +287,7 @@
* If kamlloc returns null, we just won't use that entropy
* source.
*/
- state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
+ state = kmalloc(sizeof(struct timer_rand_state), mode);
if (state) {
blkdev_timer_state[major] = state;
memset(state, 0, sizeof(struct timer_rand_state));
@@ -437,9 +437,15 @@
void add_blkdev_randomness(int major)
{
- if (major >= MAX_BLKDEV || blkdev_timer_state[major] == 0)
+ if (major >= MAX_BLKDEV)
return;
+ if (blkdev_timer_state[major] == 0) {
+ rand_initialize_blkdev(major, GFP_ATOMIC);
+ if (blkdev_timer_state[major] == 0)
+ return;
+ }
+
add_timer_randomness(&random_state, blkdev_timer_state[major],
0x200+major);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this