diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-07-02 07:52:16 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-07-14 20:17:28 -0400 |
commit | 775f4b297b780601e61787b766f306ed3e1d23eb (patch) | |
tree | e97e21669f0719636ccac0219f617bad6a0e8b54 /include/linux/random.h | |
parent | 74feec5dd83d879368c1081aec5b6a1cb6dd7ce2 (diff) |
random: make 'add_interrupt_randomness()' do something sane
We've been moving away from add_interrupt_randomness() for various
reasons: it's too expensive to do on every interrupt, and flooding the
CPU with interrupts could theoretically cause bogus floods of entropy
from a somewhat externally controllable source.
This solves both problems by limiting the actual randomness addition
to just once a second or after 64 interrupts, whicever comes first.
During that time, the interrupt cycle data is buffered up in a per-cpu
pool. Also, we make sure the the nonblocking pool used by urandom is
initialized before we start feeding the normal input pool. This
assures that /dev/urandom is returning unpredictable data as soon as
possible.
(Based on an original patch by Linus, but significantly modified by
tytso.)
Tested-by: Eric Wustrow <ewust@umich.edu>
Reported-by: Eric Wustrow <ewust@umich.edu>
Reported-by: Nadia Heninger <nadiah@cs.ucsd.edu>
Reported-by: Zakir Durumeric <zakir@umich.edu>
Reported-by: J. Alex Halderman <jhalderm@umich.edu>.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@vger.kernel.org
Diffstat (limited to 'include/linux/random.h')
-rw-r--r-- | include/linux/random.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/random.h b/include/linux/random.h index 8f74538c96db..6ef39d7f2db1 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -52,7 +52,7 @@ extern void rand_initialize_irq(int irq); | |||
52 | 52 | ||
53 | extern void add_input_randomness(unsigned int type, unsigned int code, | 53 | extern void add_input_randomness(unsigned int type, unsigned int code, |
54 | unsigned int value); | 54 | unsigned int value); |
55 | extern void add_interrupt_randomness(int irq); | 55 | extern void add_interrupt_randomness(int irq, int irq_flags); |
56 | 56 | ||
57 | extern void get_random_bytes(void *buf, int nbytes); | 57 | extern void get_random_bytes(void *buf, int nbytes); |
58 | void generate_random_uuid(unsigned char uuid_out[16]); | 58 | void generate_random_uuid(unsigned char uuid_out[16]); |