Page MenuHomeFreeBSD

D17047.diff
No OneTemporary

D17047.diff

Index: head/sys/dev/random/fortuna.c
===================================================================
--- head/sys/dev/random/fortuna.c
+++ head/sys/dev/random/fortuna.c
@@ -39,6 +39,7 @@
#ifdef _KERNEL
#include <sys/param.h>
+#include <sys/fail.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -385,6 +386,18 @@
}
#ifdef _KERNEL
+ /*
+ * When set, pretend we do not have enough entropy to reseed yet.
+ */
+ KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_pre_read, {
+ if (RETURN_VALUE != 0) {
+ RANDOM_RESEED_UNLOCK();
+ return;
+ }
+ });
+#endif
+
+#ifdef _KERNEL
fortuna_state.fs_lasttime = now;
#endif
@@ -441,6 +454,14 @@
bool
random_fortuna_seeded(void)
{
+
+#ifdef _KERNEL
+ /* When set, act as if we are not seeded. */
+ KFAIL_POINT_CODE(DEBUG_FP, random_fortuna_seeded, {
+ if (RETURN_VALUE != 0)
+ fortuna_state.fs_counter = UINT128_ZERO;
+ });
+#endif
return (!uint128_is_zero(fortuna_state.fs_counter));
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 27, 11:32 AM (4 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16195090
Default Alt Text
D17047.diff (980 B)

Event Timeline