diff options
| author | Mark Murray <markm@FreeBSD.org> | 2000-07-10 06:40:23 +0000 |
|---|---|---|
| committer | Mark Murray <markm@FreeBSD.org> | 2000-07-10 06:40:23 +0000 |
| commit | fb15ada3637acfaafa4c9f92f0012ba4b4881719 (patch) | |
| tree | f01a6cbead5077f37d0ac24b64c95db0433394cf /sys/dev/randomdev | |
| parent | 8c8970cf16d4d4ac4e11d7d7ba8b1108fadef92c (diff) | |
Notes
Diffstat (limited to 'sys/dev/randomdev')
| -rw-r--r-- | sys/dev/randomdev/yarrow.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c index c024160a73898..2ad981bbd7d66 100644 --- a/sys/dev/randomdev/yarrow.c +++ b/sys/dev/randomdev/yarrow.c @@ -53,6 +53,7 @@ static void random_harvest_internal(struct timespec *nanotime, u_int64_t entropy struct random_state random_state; /* When enough entropy has been harvested, asynchronously "stir" it in */ +/* The regate task is run at splsofttq() */ static struct task regate_task[2]; struct context { @@ -215,6 +216,10 @@ read_random(char *buf, u_int count) u_int i; u_int retval; u_int64_t genval; + intrmask_t mask; + + /* The reseed task must not be jumped on */ + mask = splsofttq(); if (gate) { generator_gate(); @@ -262,6 +267,7 @@ read_random(char *buf, u_int count) cur -= retval; } } + splx(mask); return retval; } @@ -270,10 +276,15 @@ generator_gate(void) { int i; unsigned char temp[KEYSIZE]; + intrmask_t mask; #ifdef DEBUG - /* printf("Generator gate\n"); */ + printf("Generator gate\n"); #endif + + /* The reseed task must not be jumped on */ + mask = splsofttq(); + for (i = 0; i < KEYSIZE; i += sizeof(random_state.counter)) { random_state.counter++; BF_cbc_encrypt((unsigned char *)&random_state.counter, @@ -283,6 +294,8 @@ generator_gate(void) BF_set_key(&random_state.key, KEYSIZE, temp); bzero((void *)temp, KEYSIZE); + + splx(mask); } /* Entropy harvesting routine. This is supposed to be fast; do */ |
