patch-2.2.16 linux/drivers/char/random.c

Next file: linux/drivers/char/sbc60xxwdt.c
Previous file: linux/drivers/char/pc_keyb.c
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/drivers/char/random.c linux/drivers/char/random.c
@@ -138,7 +138,7 @@
  * 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 to
+ * 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.
@@ -778,7 +778,12 @@
 
 void add_keyboard_randomness(unsigned char scancode)
 {
-	add_timer_randomness(&random_state, &keyboard_timer_state, scancode);
+	static unsigned char last_scancode = 0;
+	/* ignore autorepeat (multiple key down w/o key up) */
+	if (scancode != last_scancode) {
+		last_scancode = scancode;
+		add_timer_randomness(&random_state, &keyboard_timer_state, scancode);
+	}
 }
 
 void add_mouse_randomness(__u32 mouse_data)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)