|
@@ -1665,15 +1665,20 @@ EXPORT_SYMBOL(secure_dccp_sequence_number);
|
|
* value is not cryptographically secure but for several uses the cost of
|
|
* value is not cryptographically secure but for several uses the cost of
|
|
* depleting entropy is too high
|
|
* depleting entropy is too high
|
|
*/
|
|
*/
|
|
|
|
+DEFINE_PER_CPU(__u32 [4], get_random_int_hash);
|
|
unsigned int get_random_int(void)
|
|
unsigned int get_random_int(void)
|
|
{
|
|
{
|
|
- /*
|
|
|
|
- * Use IP's RNG. It suits our purpose perfectly: it re-keys itself
|
|
|
|
- * every second, from the entropy pool (and thus creates a limited
|
|
|
|
- * drain on it), and uses halfMD4Transform within the second. We
|
|
|
|
- * also mix it with jiffies and the PID:
|
|
|
|
- */
|
|
|
|
- return secure_ip_id((__force __be32)(current->pid + jiffies));
|
|
|
|
|
|
+ struct keydata *keyptr;
|
|
|
|
+ __u32 *hash = get_cpu_var(get_random_int_hash);
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ keyptr = get_keyptr();
|
|
|
|
+ hash[0] += current->pid + jiffies + get_cycles() + (int)(long)&ret;
|
|
|
|
+
|
|
|
|
+ ret = half_md4_transform(hash, keyptr->secret);
|
|
|
|
+ put_cpu_var(get_random_int_hash);
|
|
|
|
+
|
|
|
|
+ return ret;
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|