lkml.org 
[lkml]   [2012]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectdrivers/char/random.c: variable type mismatch
Hi,

the function add_timer_randomness currently defines:

struct {
...
unsigned cycles;
...
} sample;

Cycles used to be of type cycles_t. The inline get_cycles that fills
cycles is still of type cycles_t.

Unsigned is 32 bit whereas get_cycles is 64 bit. This means that only
the lower 32 bits of get_cycles is used.

However, due to the fact that jiffies provides very few entropy, the
event value provides (almost) none, the majority of entropy comes from
the processor cycles. Assuming that the processor cycles increase once
per nanosecond, after 2**32 cycles (about 4 seconds), the counter wraps.

This now means that on a 32 bit system, the maximum theoretical entropy
that can be added by one event is always 32 bit. But it used to be
higher due to the 64 bit type.

Now granted, the entropy estimator only assigns 11 bits of heuristic
entropy per event as a maximum.

But why weaken the RNG? Unless there is a technical problem, I would
suggest changing the variable type of cycles into unsigned long, or
better back to cycles_t.

Ciao
Stephan



\
 
 \ /
  Last update: 2012-11-08 02:02    [W:0.059 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site