Index: sys/dev/random/fortuna.c =================================================================== --- sys/dev/random/fortuna.c +++ sys/dev/random/fortuna.c @@ -39,6 +39,7 @@ #ifdef _KERNEL #include +#include #include #include #include @@ -384,6 +385,18 @@ return; } +#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 @@ -442,5 +455,13 @@ 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)); }