[PATCH 14/14] random: Remove add_interrupt_randomness

From: Matt Mackall
Date: Fri May 05 2006 - 13:09:36 EST


Remove add_interrupt_randomness

This patch removes add_interrupt_randomness, which was only used by
IRQ handlers that used to set SA_SAMPLE_RANDOM.

Signed-off-by: Matt Mackall <mpm@xxxxxxxxxxx>

Index: 2.6/drivers/char/random.c
===================================================================
--- 2.6.orig/drivers/char/random.c 2006-05-02 17:28:43.000000000 -0500
+++ 2.6/drivers/char/random.c 2006-05-03 16:47:01.000000000 -0500
@@ -127,18 +127,12 @@
*
* void add_input_randomness(unsigned int type, unsigned int code,
* unsigned int value);
- * void add_interrupt_randomness(int irq);
+ * void add_disk_randomness(struct gendisk *disk);
*
* add_input_randomness() uses the input layer interrupt timing, as well as
* the event type information from the hardware.
*
- * add_interrupt_randomness() uses the inter-interrupt timing as random
- * inputs to the entropy pool. Note that not all interrupts are good
- * sources of randomness! For example, the timer interrupts is not a
- * good choice, because the periodicity of the interrupts is too
- * regular, and hence predictable to an attacker. Disk interrupts are
- * a better measure, since the timing of the disk interrupts are more
- * unpredictable.
+ * add_disk_randomness() does the same for disk devices.
*
* All of these routines try to estimate how many bits of randomness a
* particular randomness source. They do this by keeping track of the
@@ -557,7 +551,6 @@ struct timer_rand_state {
};

static struct timer_rand_state input_timer_state;
-static struct timer_rand_state *irq_timer_state[NR_IRQS];

/*
* This function adds entropy to the entropy "pool" by using timing
@@ -647,15 +640,6 @@ void add_input_randomness(unsigned int t
(type << 4) ^ code ^ (code >> 4) ^ value);
}

-void add_interrupt_randomness(int irq)
-{
- if (irq >= NR_IRQS || irq_timer_state[irq] == 0)
- return;
-
- DEBUG_ENT("irq event %d\n", irq);
- add_timer_randomness(irq_timer_state[irq], 0x100 + irq);
-}
-
void add_disk_randomness(struct gendisk *disk)
{
if (!disk || !disk->random)
@@ -901,24 +885,6 @@ static int __init rand_initialize(void)
}
module_init(rand_initialize);

-void rand_initialize_irq(int irq)
-{
- struct timer_rand_state *state;
-
- if (irq >= NR_IRQS || irq_timer_state[irq])
- return;
-
- /*
- * If kmalloc returns null, we just won't use that entropy
- * source.
- */
- state = kmalloc(sizeof(struct timer_rand_state), GFP_KERNEL);
- if (state) {
- memset(state, 0, sizeof(struct timer_rand_state));
- irq_timer_state[irq] = state;
- }
-}
-
void rand_initialize_disk(struct gendisk *disk)
{
struct timer_rand_state *state;
Index: 2.6/include/linux/random.h
===================================================================
--- 2.6.orig/include/linux/random.h 2006-04-20 17:01:10.000000000 -0500
+++ 2.6/include/linux/random.h 2006-05-03 16:44:01.000000000 -0500
@@ -42,12 +42,8 @@ struct rand_pool_info {

#ifdef __KERNEL__

-extern void rand_initialize_irq(int irq);
-
extern void add_input_randomness(unsigned int type, unsigned int code,
unsigned int value);
-extern void add_interrupt_randomness(int irq);
-
extern void get_random_bytes(void *buf, int nbytes);
void generate_random_uuid(unsigned char uuid_out[16]);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/