From 7402d1359e445859c09a9564907c835fdf346018 Mon Sep 17 00:00:00 2001 From: green Date: Tue, 11 Jul 2000 06:47:38 +0000 Subject: One should never allocate 4-kilobyte structs and such on the interrupt stack. It's bad for your machine's health. Make the two huge structs in reseed() static to prevent crashes. This is the bug that people have been running into and panic()ing on for the past few days. Reviewed by: phk --- sys/dev/random/yarrow.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/dev/random/yarrow.c') diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c index 2ad981b..75bcf6c 100644 --- a/sys/dev/random/yarrow.c +++ b/sys/dev/random/yarrow.c @@ -101,9 +101,13 @@ random_deinit(void) static void reseed(int fastslow) { - unsigned char v[TIMEBIN][KEYSIZE]; /* v[i] */ + /* + * Allocate the huge variables statically. They _will_ run you + * out of interrupt-context stack otherwise! + */ + static BF_KEY hashkey; + static unsigned char v[TIMEBIN][KEYSIZE]; /* v[i] */ unsigned char hash[KEYSIZE]; /* h' */ - BF_KEY hashkey; unsigned char ivec[8]; unsigned char temp[KEYSIZE]; struct entropy *bucket; -- cgit v1.1