Page MenuHomeFreeBSD

D16866.id47164.diff
No OneTemporary

D16866.id47164.diff

Index: sys/dev/random/fortuna.c
===================================================================
--- sys/dev/random/fortuna.c
+++ sys/dev/random/fortuna.c
@@ -371,7 +371,7 @@
if (fortuna_state.fs_pool[0].fsp_length >= fortuna_state.fs_minpoolsize
#ifdef _KERNEL
/* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */
- && (now - fortuna_state.fs_lasttime > hz/10)
+ && (now - fortuna_state.fs_lasttime > SBT_1S/10)
#endif
) {
#ifdef _KERNEL
Index: sys/dev/random/random_harvestq.c
===================================================================
--- sys/dev/random/random_harvestq.c
+++ sys/dev/random/random_harvestq.c
@@ -57,6 +57,10 @@
#include <machine/atomic.h>
#include <machine/cpu.h>
+#include <crypto/rijndael/rijndael-api-fst.h>
+#include <crypto/sha2/sha256.h>
+
+#include <dev/random/hash.h>
#include <dev/random/randomdev.h>
#include <dev/random/random_harvestq.h>
@@ -212,9 +216,10 @@
if (p_random_alg_context) {
/* It's an indenting error. Yeah, Yeah. */
#endif
- local_read_rate = atomic_readandclear_32(&read_rate);
+ local_read_rate = atomic_readandclear_32(&read_rate) + 1;
+ local_read_rate = MIN(local_read_rate, RANDOM_KEYSIZE_WORDS);
LIST_FOREACH(rrs, &source_list, rrs_entries) {
- for (i = 0; i < p_random_alg_context->ra_poolcount*(local_read_rate + 1); i++) {
+ for (i = 0; i < p_random_alg_context->ra_poolcount*local_read_rate; i++) {
n = rrs->rrs_source->rs_read(entropy, sizeof(entropy));
KASSERT((n <= sizeof(entropy)), ("%s: rs_read returned too much data (%u > %zu)", __func__, n, sizeof(entropy)));
/* It would appear that in some circumstances (e.g. virtualisation),

File Metadata

Mime Type
text/plain
Expires
Sat, May 23, 10:13 PM (3 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33455992
Default Alt Text
D16866.id47164.diff (1 KB)

Event Timeline