aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/random.h6
-rw-r--r--lib/random32.c14
2 files changed, 10 insertions, 10 deletions
diff --git a/include/linux/random.h b/include/linux/random.h
index 6312dd9ba449..bf9085e89fb5 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -50,9 +50,9 @@ static inline void prandom_seed_state(struct rnd_state *state, u64 seed)
50{ 50{
51 u32 i = (seed >> 32) ^ (seed << 10) ^ seed; 51 u32 i = (seed >> 32) ^ (seed << 10) ^ seed;
52 52
53 state->s1 = __seed(i, 1); 53 state->s1 = __seed(i, 2);
54 state->s2 = __seed(i, 7); 54 state->s2 = __seed(i, 8);
55 state->s3 = __seed(i, 15); 55 state->s3 = __seed(i, 16);
56} 56}
57 57
58#ifdef CONFIG_ARCH_RANDOM 58#ifdef CONFIG_ARCH_RANDOM
diff --git a/lib/random32.c b/lib/random32.c
index 52280d5526be..01e8890d1089 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -141,7 +141,7 @@ void prandom_seed(u32 entropy)
141 */ 141 */
142 for_each_possible_cpu (i) { 142 for_each_possible_cpu (i) {
143 struct rnd_state *state = &per_cpu(net_rand_state, i); 143 struct rnd_state *state = &per_cpu(net_rand_state, i);
144 state->s1 = __seed(state->s1 ^ entropy, 1); 144 state->s1 = __seed(state->s1 ^ entropy, 2);
145 } 145 }
146} 146}
147EXPORT_SYMBOL(prandom_seed); 147EXPORT_SYMBOL(prandom_seed);
@@ -158,9 +158,9 @@ static int __init prandom_init(void)
158 struct rnd_state *state = &per_cpu(net_rand_state,i); 158 struct rnd_state *state = &per_cpu(net_rand_state,i);
159 159
160#define LCG(x) ((x) * 69069) /* super-duper LCG */ 160#define LCG(x) ((x) * 69069) /* super-duper LCG */
161 state->s1 = __seed(LCG(i + jiffies), 1); 161 state->s1 = __seed(LCG(i + jiffies), 2);
162 state->s2 = __seed(LCG(state->s1), 7); 162 state->s2 = __seed(LCG(state->s1), 8);
163 state->s3 = __seed(LCG(state->s2), 15); 163 state->s3 = __seed(LCG(state->s2), 16);
164 164
165 /* "warm it up" */ 165 /* "warm it up" */
166 prandom_u32_state(state); 166 prandom_u32_state(state);
@@ -187,9 +187,9 @@ static int __init prandom_reseed(void)
187 u32 seeds[3]; 187 u32 seeds[3];
188 188
189 get_random_bytes(&seeds, sizeof(seeds)); 189 get_random_bytes(&seeds, sizeof(seeds));
190 state->s1 = __seed(seeds[0], 1); 190 state->s1 = __seed(seeds[0], 2);
191 state->s2 = __seed(seeds[1], 7); 191 state->s2 = __seed(seeds[1], 8);
192 state->s3 = __seed(seeds[2], 15); 192 state->s3 = __seed(seeds[2], 16);
193 193
194 /* mix it in */ 194 /* mix it in */
195 prandom_u32_state(state); 195 prandom_u32_state(state);