Page MenuHomeFreeBSD

D35802.id108356.diff
No OneTemporary

D35802.id108356.diff

Index: sys/dev/random/random_harvestq.c
===================================================================
--- sys/dev/random/random_harvestq.c
+++ sys/dev/random/random_harvestq.c
@@ -254,6 +254,28 @@
*/
npools = howmany(p_random_alg_context->ra_poolcount, RANDOM_KTHREAD_HZ);
+ /*-
+ * If we're not seeded yet, attempt to perform a "full seed", filling
+ * all of the PRNG's pools with entropy; if there is enough entropy
+ * available from "fast" entropy sources this will allow us to finish
+ * seeding and unblock the boot process immediately rather than being
+ * stuck for a few seconds with random_kthread gradually collecting a
+ * small chunk of entropy every 1 / RANDOM_KTHREAD_HZ seconds.
+ *
+ * The value 64 below is RANDOM_FORTUNA_DEFPOOLSIZE, i.e. chosen to
+ * fill Fortuna's pools in the default configuration. With another
+ * PRNG or smaller pools for Fortuna, we might collect more entropy
+ * than needed to fill the pools, but this is harmless; alternatively,
+ * a different PRNG, larger pools, or fast entropy sources which are
+ * not able to provide as much entropy as we request may result in the
+ * not being fully seeded (and thus remaining blocked) but in that
+ * case we will return here after 1 / RANDOM_KTHREAD_HZ seconds and
+ * try again for a large amount of entropy.
+ */
+ if (!p_random_alg_context->ra_seeded())
+ npools = howmany(p_random_alg_context->ra_poolcount * 64,
+ sizeof(entropy));
+
/*
* Step over all of live entropy sources, and feed their output
* to the system-wide RNG.

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 10:23 AM (3 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28568059
Default Alt Text
D35802.id108356.diff (1 KB)

Event Timeline