summaryrefslogtreecommitdiffstats
path: root/sys/dev/random
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>2000-07-10 06:40:23 +0000
committermarkm <markm@FreeBSD.org>2000-07-10 06:40:23 +0000
commit950c011f72ff18d6405e594aa2f57bee02078239 (patch)
tree905ab9ec24ef96be20d8c80e180a54b21a41e5c2 /sys/dev/random
parent78f990a287c045fa789a3ba8c3c47678151266cc (diff)
downloadFreeBSD-src-950c011f72ff18d6405e594aa2f57bee02078239.zip
FreeBSD-src-950c011f72ff18d6405e594aa2f57bee02078239.tar.gz
Provide more splsofttq() protection for the reseed task (running out of
taskqueue_swi).
Diffstat (limited to 'sys/dev/random')
-rw-r--r--sys/dev/random/yarrow.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c
index c024160..2ad981b 100644
--- a/sys/dev/random/yarrow.c
+++ b/sys/dev/random/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 */
OpenPOWER on IntegriCloud