From 4d0e6f79d62c5a8b2edf7fe8bc807c6651c13dcd Mon Sep 17 00:00:00 2001 From: Mark Murray Date: Tue, 11 Jul 2000 19:37:25 +0000 Subject: [PATCH] Storing to a pointer is (effectively) atomic; no need to protect this with splhigh(). However, the entropy-harvesting routine needs pretty serious irq-protection, as it is called out of irq handlers etc. Clues given by: bde --- sys/dev/random/harvest.c | 8 -------- sys/dev/random/yarrow.c | 4 ++-- sys/dev/randomdev/harvest.c | 8 -------- sys/dev/randomdev/yarrow.c | 4 ++-- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/sys/dev/random/harvest.c b/sys/dev/random/harvest.c index ceb9f9f3a5c6..591d0d023e25 100644 --- a/sys/dev/random/harvest.c +++ b/sys/dev/random/harvest.c @@ -47,22 +47,14 @@ static void (*reap)(struct timespec *, u_int64_t, u_int, u_int, u_int) = NULL; void random_init_harvester(void (*reaper)(struct timespec *, u_int64_t, u_int, u_int, u_int)) { - intrmask_t mask; - - mask = splhigh(); reap = reaper; - splx(mask); } /* Deinitialise the harvester at unload time */ void random_deinit_harvester(void) { - intrmask_t mask; - - mask = splhigh(); reap = NULL; - splx(mask); } /* Entropy harvesting routine. This is supposed to be fast; do */ diff --git a/sys/dev/random/yarrow.c b/sys/dev/random/yarrow.c index 99453f6a3e91..c6ae4481a0eb 100644 --- a/sys/dev/random/yarrow.c +++ b/sys/dev/random/yarrow.c @@ -320,8 +320,8 @@ random_harvest_internal(struct timespec *nanotime, u_int64_t entropy, #endif if (origin < ENTROPYSOURCE) { - /* The reseed task must not be jumped on */ - mask = splsofttq(); + /* Called inside irq handlers; protect from interference */ + mask = splhigh(); which = random_state.which; pool = &random_state.pool[which]; diff --git a/sys/dev/randomdev/harvest.c b/sys/dev/randomdev/harvest.c index ceb9f9f3a5c6..591d0d023e25 100644 --- a/sys/dev/randomdev/harvest.c +++ b/sys/dev/randomdev/harvest.c @@ -47,22 +47,14 @@ static void (*reap)(struct timespec *, u_int64_t, u_int, u_int, u_int) = NULL; void random_init_harvester(void (*reaper)(struct timespec *, u_int64_t, u_int, u_int, u_int)) { - intrmask_t mask; - - mask = splhigh(); reap = reaper; - splx(mask); } /* Deinitialise the harvester at unload time */ void random_deinit_harvester(void) { - intrmask_t mask; - - mask = splhigh(); reap = NULL; - splx(mask); } /* Entropy harvesting routine. This is supposed to be fast; do */ diff --git a/sys/dev/randomdev/yarrow.c b/sys/dev/randomdev/yarrow.c index 99453f6a3e91..c6ae4481a0eb 100644 --- a/sys/dev/randomdev/yarrow.c +++ b/sys/dev/randomdev/yarrow.c @@ -320,8 +320,8 @@ random_harvest_internal(struct timespec *nanotime, u_int64_t entropy, #endif if (origin < ENTROPYSOURCE) { - /* The reseed task must not be jumped on */ - mask = splsofttq(); + /* Called inside irq handlers; protect from interference */ + mask = splhigh(); which = random_state.which; pool = &random_state.pool[which];