--- random_harvestq.c.orig 2018-08-22 02:14:41.673532000 +0100 +++ random_harvestq.c 2018-08-22 19:58:41.329400000 +0100 @@ -55,6 +55,10 @@ #include #include +#include +#include + +#include #include #include @@ -209,6 +213,9 @@ /* It's an indenting error. Yeah, Yeah. */ #endif local_read_rate = atomic_readandclear_32(&read_rate); + /* Don't waste CPU cycles hashing more than the generator can use */ + if (local_read_rate > RANDOM_KEYSIZE_WORDS - 1) + local_read_rate = RANDOM_KEYSIZE_WORDS - 1; LIST_FOREACH(rrs, &source_list, rrs_entries) { for (i = 0; i < p_random_alg_context->ra_poolcount*(local_read_rate + 1); i++) { n = rrs->rrs_source->rs_read(entropy, sizeof(entropy));