Page MenuHomeFreeBSD

D20239.id57318.diff
No OneTemporary

D20239.id57318.diff

Index: sys/dev/random/fortuna.c
===================================================================
--- sys/dev/random/fortuna.c
+++ sys/dev/random/fortuna.c
@@ -377,8 +377,12 @@
if (fortuna_state.fs_pool[0].fsp_length < fortuna_state.fs_minpoolsize
#ifdef _KERNEL
- /* FS&K - Use 'getsbinuptime()' to prevent reseed-spamming. */
- || (now - fortuna_state.fs_lasttime <= SBT_1S/10)
+ /*
+ * FS&K - Use 'getsbinuptime()' to prevent reseed-spamming, but do
+ * not block initial seeding (fs_lasttime == 0).
+ */
+ || (__predict_true(fortuna_state.fs_lasttime != 0) &&
+ now - fortuna_state.fs_lasttime <= SBT_1S/10)
#endif
) {
RANDOM_RESEED_UNLOCK();
@@ -469,5 +473,14 @@
return (false);
#endif
+ if (__predict_true(!uint128_is_zero(fortuna_state.fs_counter)))
+ return (true);
+
+ /*
+ * Maybe we have enough entropy in the zeroth pool but just haven't
+ * kicked the initial seed step. Do so now.
+ */
+ random_fortuna_pre_read();
+
return (!uint128_is_zero(fortuna_state.fs_counter));
}

File Metadata

Mime Type
text/plain
Expires
Fri, Apr 24, 4:34 AM (12 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32060274
Default Alt Text
D20239.id57318.diff (1 KB)

Event Timeline