diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-10-12 14:57:14 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-10-12 14:57:14 +0000 |
commit | 8917c3df21f42e54a03bee9bff878f33ed76659c (patch) | |
tree | 2955c5d8607a7cafd55350e8091656ef40ca2fe1 /sys/dev/random | |
parent | 332eded02e8867048798b04537c428462ae6a0d9 (diff) | |
download | FreeBSD-src-8917c3df21f42e54a03bee9bff878f33ed76659c.zip FreeBSD-src-8917c3df21f42e54a03bee9bff878f33ed76659c.tar.gz |
Assert that the entropy source category provided by a caller submitting
entropy is valid, as an invalid source will cause dereferencing of an
array of queues to an incorrect memory location.
Diffstat (limited to 'sys/dev/random')
-rw-r--r-- | sys/dev/random/randomdev_soft.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/random/randomdev_soft.c b/sys/dev/random/randomdev_soft.c index 3f5fb5d..5847022 100644 --- a/sys/dev/random/randomdev_soft.c +++ b/sys/dev/random/randomdev_soft.c @@ -301,6 +301,12 @@ random_harvest_internal(u_int64_t somecounter, const void *entropy, { struct harvest *event; + KASSERT(origin == RANDOM_START || origin == RANDOM_WRITE || + origin == RANDOM_KEYBOARD || origin == RANDOM_MOUSE || + origin == RANDOM_NET || origin == RANDOM_INTERRUPT || + origin == RANDOM_PURE || origin == ENTROPYSOURCE, + ("random_harvest_internal: origin %d invalid\n", origin)); + /* Lockless read to avoid lock operations if fifo is full. */ if (harvestfifo[origin].count >= RANDOM_FIFO_MAX) return; |