All of lore.kernel.org
 help / color / mirror / Atom feed
* USB HID devices not linked to RNG
@ 2015-09-07  0:10 Stephan Mueller
  2015-09-07  0:12 ` Stephan Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Stephan Mueller @ 2015-09-07  0:10 UTC (permalink / raw)
  To: linux-crypto, linux-input; +Cc: tytso

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: USB HID devices not linked to RNG
  2015-09-07  0:10 USB HID devices not linked to RNG Stephan Mueller
@ 2015-09-07  0:12 ` Stephan Mueller
  2015-09-07 20:07   ` Mike Mestnik
  0 siblings, 1 reply; 6+ messages in thread
From: Stephan Mueller @ 2015-09-07  0:12 UTC (permalink / raw)
  To: linux-crypto; +Cc: linux-input, tytso

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: USB HID devices not linked to RNG
  2015-09-07  0:12 ` Stephan Mueller
@ 2015-09-07 20:07   ` Mike Mestnik
  2015-09-07 21:09     ` Stephan Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Mestnik @ 2015-09-07 20:07 UTC (permalink / raw)
  To: Stephan Mueller; +Cc: linux-crypto, linux-input, tytso

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 <smueller@chronox.de> wrote:
> 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
> --
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: USB HID devices not linked to RNG
  2015-09-07 20:07   ` Mike Mestnik
@ 2015-09-07 21:09     ` Stephan Mueller
  2015-09-09  5:40       ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Stephan Mueller @ 2015-09-07 21:09 UTC (permalink / raw)
  To: Mike Mestnik; +Cc: linux-crypto, linux-input, tytso

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: USB HID devices not linked to RNG
  2015-09-07 21:09     ` Stephan Mueller
@ 2015-09-09  5:40       ` Dmitry Torokhov
  2015-09-09 12:24         ` Stephan Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2015-09-09  5:40 UTC (permalink / raw)
  To: Stephan Mueller
  Cc: Mike Mestnik, linux-crypto, linux-input, Theodore Ts'o

On Mon, Sep 7, 2015 at 2:09 PM, Stephan Mueller <smueller@chronox.de> wrote:
> 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?

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: USB HID devices not linked to RNG
  2015-09-09  5:40       ` Dmitry Torokhov
@ 2015-09-09 12:24         ` Stephan Mueller
  0 siblings, 0 replies; 6+ messages in thread
From: Stephan Mueller @ 2015-09-09 12:24 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Mike Mestnik, linux-crypto, linux-input, Theodore Ts'o

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-09 12:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-07  0:10 USB HID devices not linked to RNG Stephan Mueller
2015-09-07  0:12 ` Stephan Mueller
2015-09-07 20:07   ` Mike Mestnik
2015-09-07 21:09     ` Stephan Mueller
2015-09-09  5:40       ` Dmitry Torokhov
2015-09-09 12:24         ` Stephan Mueller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.