diff options
author | Jarod Wilson <jarod@redhat.com> | 2011-02-21 05:43:10 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2011-02-21 06:42:42 -0500 |
commit | 442a4fffffa26fc3080350b4d50172f7589c3ac2 (patch) | |
tree | 18f99b2ab50cda90bc64ad49560860729a92c1c2 /drivers/char | |
parent | ce92136843cb6e14aba5fd7bc4e88dbe71e70c5a (diff) |
random: update interface comments to reflect reality
At present, the comment header in random.c makes no mention of
add_disk_randomness, and instead, suggests that disk activity adds to the
random pool by way of add_interrupt_randomness, which appears to not have
been the case since sometime prior to the existence of git, and even prior
to bitkeeper. Didn't look any further back. At least, as far as I can
tell, there are no storage drivers setting IRQF_SAMPLE_RANDOM, which is a
requirement for add_interrupt_randomness to trigger, so the only way for a
disk to contribute entropy is by way of add_disk_randomness. Update
comments accordingly, complete with special mention about solid state
drives being a crappy source of entropy (see e2e1a148bc for reference).
Signed-off-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/random.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 72a4fcb17745..5e29e8031bbc 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c | |||
@@ -128,6 +128,7 @@ | |||
128 | * void add_input_randomness(unsigned int type, unsigned int code, | 128 | * void add_input_randomness(unsigned int type, unsigned int code, |
129 | * unsigned int value); | 129 | * unsigned int value); |
130 | * void add_interrupt_randomness(int irq); | 130 | * void add_interrupt_randomness(int irq); |
131 | * void add_disk_randomness(struct gendisk *disk); | ||
131 | * | 132 | * |
132 | * add_input_randomness() uses the input layer interrupt timing, as well as | 133 | * add_input_randomness() uses the input layer interrupt timing, as well as |
133 | * the event type information from the hardware. | 134 | * the event type information from the hardware. |
@@ -136,9 +137,15 @@ | |||
136 | * inputs to the entropy pool. Note that not all interrupts are good | 137 | * inputs to the entropy pool. Note that not all interrupts are good |
137 | * sources of randomness! For example, the timer interrupts is not a | 138 | * sources of randomness! For example, the timer interrupts is not a |
138 | * good choice, because the periodicity of the interrupts is too | 139 | * good choice, because the periodicity of the interrupts is too |
139 | * regular, and hence predictable to an attacker. Disk interrupts are | 140 | * regular, and hence predictable to an attacker. Network Interface |
140 | * a better measure, since the timing of the disk interrupts are more | 141 | * Controller interrupts are a better measure, since the timing of the |
141 | * unpredictable. | 142 | * NIC interrupts are more unpredictable. |
143 | * | ||
144 | * add_disk_randomness() uses what amounts to the seek time of block | ||
145 | * layer request events, on a per-disk_devt basis, as input to the | ||
146 | * entropy pool. Note that high-speed solid state drives with very low | ||
147 | * seek times do not make for good sources of entropy, as their seek | ||
148 | * times are usually fairly consistent. | ||
142 | * | 149 | * |
143 | * All of these routines try to estimate how many bits of randomness a | 150 | * All of these routines try to estimate how many bits of randomness a |
144 | * particular randomness source. They do this by keeping track of the | 151 | * particular randomness source. They do this by keeping track of the |