summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2012-07-23 09:47:57 -0700
committerWilly Tarreau <w@1wt.eu>2012-10-07 23:41:21 +0200
commita76be4858901fd9fd0fb8f594f660d1037cb03d8 (patch)
tree1c3935f2918693dad3928b06c838a72f89e1a765
parentfe1f4c7d2602bda2dddb13fd34e9678514478e12 (diff)
random: Add comment to random_initialize()
commit cbc96b7594b5691d61eba2db8b2ea723645be9ca upstream. Many platforms have per-machine instance data (serial numbers, asset tags, etc.) squirreled away in areas that are accessed during early system bringup. Mixing this data into the random pools has a very high value in providing better random data, so we should allow (and even encourage) architecture code to call add_device_randomness() from the setup_arch() paths. However, this limits our options for internal structure of the random driver since random_initialize() is not called until long after setup_arch(). Add a big fat comment to rand_initialize() spelling out this requirement. Suggested-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Willy Tarreau <w@1wt.eu>
-rw-r--r--drivers/char/random.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index cbb63b0e3ef8..446b20afee74 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1077,6 +1077,16 @@ static void init_std_data(struct entropy_store *r)
mix_pool_bytes(r, utsname(), sizeof(*(utsname())), NULL);
}
+/*
+ * Note that setup_arch() may call add_device_randomness()
+ * long before we get here. This allows seeding of the pools
+ * with some platform dependent data very early in the boot
+ * process. But it limits our options here. We must use
+ * statically allocated structures that already have all
+ * initializations complete at compile time. We should also
+ * take care not to overwrite the precious per platform data
+ * we were given.
+ */
static int rand_initialize(void)
{
init_std_data(&input_pool);