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,17 @@ return; } + /* + * 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; + } + }); + + #ifdef _KERNEL fortuna_state.fs_lasttime = now; #endif @@ -442,5 +454,11 @@ random_fortuna_seeded(void) { + /* 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; + }); + return (!uint128_is_zero(fortuna_state.fs_counter)); }