Merge branch 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'x86-rdrand-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: random: Use arch_get_random_int instead of cycle counter if avail
This commit is contained in:
commit
7a222156bc
|
@ -624,8 +624,8 @@ static struct timer_rand_state input_timer_state;
|
||||||
static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
|
static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
cycles_t cycles;
|
|
||||||
long jiffies;
|
long jiffies;
|
||||||
|
unsigned cycles;
|
||||||
unsigned num;
|
unsigned num;
|
||||||
} sample;
|
} sample;
|
||||||
long delta, delta2, delta3;
|
long delta, delta2, delta3;
|
||||||
|
@ -637,7 +637,11 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
sample.jiffies = jiffies;
|
sample.jiffies = jiffies;
|
||||||
sample.cycles = get_cycles();
|
|
||||||
|
/* Use arch random value, fall back to cycles */
|
||||||
|
if (!arch_get_random_int(&sample.cycles))
|
||||||
|
sample.cycles = get_cycles();
|
||||||
|
|
||||||
sample.num = num;
|
sample.num = num;
|
||||||
mix_pool_bytes(&input_pool, &sample, sizeof(sample));
|
mix_pool_bytes(&input_pool, &sample, sizeof(sample));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue