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

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

Advertisement

Kernel v2.6.29.5-rc1 /drivers/char/random.c

Filename:/drivers/char/random.c
Lines Added:12
Lines Deleted:7
Also changed in: (Previous) 2.6.29-git15  2.6.29-git14  2.6.29-git13  2.6.29-git12  2.6.29-git11  2.6.29-git10 
(Following) 2.6.30  2.6.31-git3  2.6.31-git4  2.6.31-git5  2.6.31-git6  2.6.31-git7 

Location
[  2.6.29.5-rc1
  [  drivers
    [  char
       o  random.c

Patch

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 7c13581..7a05cf9 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1660,15 +1660,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.