From 348fec78a63fc91b4d0bf2534d56b4f7cb7a27c1 Mon Sep 17 00:00:00 2001 From: Joe Maples Date: Sun, 28 Aug 2016 13:10:23 +0000 Subject: random: Backport driver from 4.1.31 Signed-off-by: Joe Maples --- lib/random32.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/random32.c b/lib/random32.c index ae95d5154..0bee183fa 100644 --- a/lib/random32.c +++ b/lib/random32.c @@ -151,7 +151,8 @@ static u32 __extract_hwseed(void) { unsigned int val = 0; - (void)(arch_get_random_int(&val)); + (void)(arch_get_random_seed_int(&val) || + arch_get_random_int(&val)); return val; } @@ -220,7 +221,7 @@ static void __prandom_timer(unsigned long dontcare) u32 entropy; unsigned long expires; - erandom_get_random_bytes((char *)&entropy, sizeof(entropy)); + get_random_bytes(&entropy, sizeof(entropy)); prandom_seed(entropy); /* reseed every ~60 seconds, in [40 .. 80) interval with slack */ @@ -270,7 +271,7 @@ static void __prandom_reseed(bool late) struct rnd_state *state = &per_cpu(net_rand_state,i); u32 seeds[4]; - erandom_get_random_bytes((char *)&seeds, sizeof(seeds)); + get_random_bytes(&seeds, sizeof(seeds)); state->s1 = __seed(seeds[0], 2U); state->s2 = __seed(seeds[1], 8U); state->s3 = __seed(seeds[2], 16U); -- cgit v1.2.3