diff options
author | Tony Luck <tony.luck@intel.com> | 2012-07-23 12:47:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-15 15:04:29 -0400 |
commit | dbbdd2bb89716814a5336105d8b3e6fd64ff0886 (patch) | |
tree | 96b0ce71291b06b8030559310933b422e405d139 | |
parent | b6b847a93be87fc9974d8232984668a5a59754df (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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/char/random.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 5df09b014ea..c2e25afdbe5 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -1087,6 +1087,16 @@ static void init_std_data(struct entropy_store *r) | |||
1087 | mix_pool_bytes(r, utsname(), sizeof(*(utsname())), NULL); | 1087 | mix_pool_bytes(r, utsname(), sizeof(*(utsname())), NULL); |
1088 | } | 1088 | } |
1089 | 1089 | ||
1090 | /* | ||
1091 | * Note that setup_arch() may call add_device_randomness() | ||
1092 | * long before we get here. This allows seeding of the pools | ||
1093 | * with some platform dependent data very early in the boot | ||
1094 | * process. But it limits our options here. We must use | ||
1095 | * statically allocated structures that already have all | ||
1096 | * initializations complete at compile time. We should also | ||
1097 | * take care not to overwrite the precious per platform data | ||
1098 | * we were given. | ||
1099 | */ | ||
1090 | static int rand_initialize(void) | 1100 | static int rand_initialize(void) |
1091 | { | 1101 | { |
1092 | init_std_data(&input_pool); | 1102 | init_std_data(&input_pool); |