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 +#include #include #include #include @@ -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)); }