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
This commit is contained in:
Brian Feldman 2000-07-11 06:47:38 +00:00
parent 11128de973
commit 87a478de7b
2 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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;