Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.30-rc4-git4 /drivers/char/random.c

Filename:/drivers/char/random.c
Lines Added:12
Lines Deleted:7
Also changed in: (Previous) 2.6.30-rc4  2.6.30-rc3  2.6.30-rc2  2.6.30-rc1  2.6.29-git15  2.6.29-git14 
(Following) 2.6.30-rc5  2.6.30-rc6  2.6.30-rc6-git5  2.6.30-rc6-git6  2.6.30-rc6-git7  2.6.30-rc6-git8 

Location
[  2.6.30-rc4-git4
  [  drivers
    [  char
       o  random.c

Patch

diff --git a/drivers/char/random.c b/drivers/char/random.c
index f824ef8..b2ced39 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1665,15 +1665,20 @@ EXPORT_SYMBOL(secure_dccp_sequence_number);
  * value is not cryptographically secure but for several uses the cost of
  * depleting entropy is too high
  */
+DEFINE_PER_CPU(__u32 [4], get_random_int_hash);
 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;
 }
 
 /*


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.