From: Stephen Hemminger Please consider this patch instead for fixing the seeding issue with random32. The rationale is: * use u32 consistently * no need to do LCG on values from (better) get_random_bytes * use more data from get_random_bytes for secondary seeding * don't reduce state space on srandom32() * enforce state variable initialization restrictions Note: the second paper has a version of random32() with even longer period and a version of random64() if needed. Signed-off-by: Stephen Hemminger Cc: Jack Lloyd Cc: Theodore Ts'o Cc: Matt Mackall Cc: David S. Miller Cc: Andi Kleen Cc: Benoit Boissinot Signed-off-by: Andrew Morton --- lib/random32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff -puN lib/random32.c~random32-seeding-improvement-v2 lib/random32.c --- a/lib/random32.c~random32-seeding-improvement-v2 +++ a/lib/random32.c @@ -112,7 +112,7 @@ static int __init random32_init(void) for_each_possible_cpu(i) { struct rnd_state *state = &per_cpu(net_rand_state,i); -#define LCG(x) (x * 69069) /* super-duper LCG */ +#define LCG(x) ((x) * 69069) /* super-duper LCG */ state->s1 = __seed(LCG(i + jiffies), 1); state->s2 = __seed(LCG(state->s1), 7); state->s3 = __seed(LCG(state->s2), 15); _