USB HID devices not linked to RNG

6 messages, 3 authors, 2015-09-09 · open the first message on its own page

USB HID devices not linked to RNG

From: Stephan Mueller <hidden>
Date: 2015-09-07 00:10:16

Hi,

While analyzing the entropy sources for the random number generator in 
drivers/char/random.c, I saw that a USB mouse and a USB keyboard does trigger 
the add_input_randomness function to be triggered.

Is that intended? 

-- 
Ciao
Stephan

Re: USB HID devices not linked to RNG

From: Stephan Mueller <hidden>
Date: 2015-09-07 00:12:56

Am Montag, 7. September 2015, 02:10:16 schrieb Stephan Mueller:

Hi Stephan,
Hi,

While analyzing the entropy sources for the random number generator in
drivers/char/random.c, I saw that a USB mouse and a USB keyboard does
trigger the add_input_randomness function to be triggered.
I need to reread what I write :-)

I mean that the USB mouse and USB keyboard does *not* trigger the 
add_input_randomness function.
Is that intended?

-- 
Ciao
Stephan

Re: USB HID devices not linked to RNG

From: Mike Mestnik <hidden>
Date: 2015-09-07 20:07:49

This is just an off the wall guess.  Wouldn't such entropy already be
collected at a lower level, like raw usb traffic?

On Sun, Sep 6, 2015 at 7:12 PM, Stephan Mueller [off-list ref] wrote:
Am Montag, 7. September 2015, 02:10:16 schrieb Stephan Mueller:

Hi Stephan,
quoted
Hi,

While analyzing the entropy sources for the random number generator in
drivers/char/random.c, I saw that a USB mouse and a USB keyboard does
trigger the add_input_randomness function to be triggered.
I need to reread what I write :-)

I mean that the USB mouse and USB keyboard does *not* trigger the
add_input_randomness function.
quoted
Is that intended?

--
Ciao
Stephan
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Re: USB HID devices not linked to RNG

From: Stephan Mueller <hidden>
Date: 2015-09-07 21:09:22

Am Montag, 7. September 2015, 15:07:47 schrieb Mike Mestnik:

Hi Mike,
This is just an off the wall guess.  Wouldn't such entropy already be
collected at a lower level, like raw usb traffic?
The RNG collects data from interrupts (that also covers normal PS/2 mice and 
keyboards), block devices and HID (it hooks itself into the input layer).

So, raw USB traffic is not a source of entropy other than for the interrupts 
the base PCI traffic would generate.

What I am wondering: isn't the USB mouse/keyboard support hooking into the 
kernel's input layer?

Ciao
Stephan

Re: USB HID devices not linked to RNG

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2015-09-09 05:40:07

On Mon, Sep 7, 2015 at 2:09 PM, Stephan Mueller [off-list ref] wrote:
Am Montag, 7. September 2015, 15:07:47 schrieb Mike Mestnik:

Hi Mike,
quoted
This is just an off the wall guess.  Wouldn't such entropy already be
collected at a lower level, like raw usb traffic?
The RNG collects data from interrupts (that also covers normal PS/2 mice and
keyboards), block devices and HID (it hooks itself into the input layer).

So, raw USB traffic is not a source of entropy other than for the interrupts
the base PCI traffic would generate.

What I am wondering: isn't the USB mouse/keyboard support hooking into the
kernel's input layer?
All input devices add randomness, however I think for mouse
add_input_randomness() will drop majority of events since they are
likely have the same value (well, depends on which direction you are
moving the mouse)...

-- 
Dmitry

Re: USB HID devices not linked to RNG

From: Stephan Mueller <hidden>
Date: 2015-09-09 12:24:54

Am Dienstag, 8. September 2015, 22:40:07 schrieb Dmitry Torokhov:

Hi Dmitry,
All input devices add randomness, however I think for mouse
add_input_randomness() will drop majority of events since they are
likely have the same value (well, depends on which direction you are
moving the mouse)...
I agree that such mechanism is present, but it is implemented by 
add_input_randomness:

        /* ignore autorepeat and the like */
        if (value == last_value)
                return;

So, when we install a probe at the entry into add_input_randomness, we should 
see invocations.

The problem now is that add_input_randomness is not called at all.

Simply use the following code as a systemtap script, load it and move a USB 
mouse or type on a USB keyboard:

probe kernel.function("add_input_randomness") {
	printf("add_input_randomness triggered\n");
}

Expected behavior: tons of printouts should be received (as it is the case 
with PS/2 mice and keyboards).

Actual behavior: no printout when moving USB HID.


Ciao
Stephan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help