Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151889995
D16873.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D16873.diff
View Options
Index: head/sys/dev/random/random_harvestq.c
===================================================================
--- head/sys/dev/random/random_harvestq.c
+++ head/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>
@@ -213,8 +217,12 @@
/* It's an indenting error. Yeah, Yeah. */
#endif
local_read_rate = atomic_readandclear_32(&read_rate);
+ /* Perform at least one read per round */
+ local_read_rate = MAX(local_read_rate, 1);
+ /* But not exceeding RANDOM_KEYSIZE_WORDS */
+ 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
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 12, 9:30 AM (9 m, 23 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31340339
Default Alt Text
D16873.diff (1 KB)
Attached To
Mode
D16873: Limit the harvest rate of "fast" entropy for random(4) so as not to overload the system.
Attached
Detach File
Event Timeline
Log In to Comment