aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-11-11 12:20:34 +0100
committerMoyster <oysterized@gmail.com>2016-09-10 12:06:14 +0200
commit5b8f37307366779fcbd2da89fcac6f2f3e776708 (patch)
tree7b3930fce2aaabcdf2705741d46d6101ec1f63f9 /drivers/char
parent5397b9894c1bf94fa500ac434282eb2cb210992b (diff)
random32: add prandom_reseed_late() and call when nonblocking pool becomes initialized
The Tausworthe PRNG is initialized at late_initcall time. At that time the entropy pool serving get_random_bytes is not filled sufficiently. This patch adds an additional reseeding step as soon as the nonblocking pool gets marked as initialized. On some machines it might be possible that late_initcall gets called after the pool has been initialized. In this situation we won't reseed again. (A call to prandom_seed_late blocks later invocations of early reseed attempts.) Joint work with Daniel Borkmann. Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Acked-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/random.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 9a709c89a..5cd737915 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -606,8 +606,11 @@ retry:
if (!r->initialized && nbits > 0) {
r->entropy_total += nbits;
- if (r->entropy_total > 128)
+ if (r->entropy_total > 128) {
r->initialized = 1;
+ if (r == &nonblocking_pool)
+ prandom_reseed_late();
+ }
}
trace_credit_entropy_bits(r->name, nbits, entropy_count,