]> Pileus Git - ~andy/linux/commitdiff
net: switch net_secret key generation to net_get_random_once
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Sat, 19 Oct 2013 19:48:59 +0000 (21:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 19 Oct 2013 23:45:36 +0000 (19:45 -0400)
Cc: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/secure_seq.c

index 3f1ec1586ae174d9bea18de2bcada31c3c88a5bb..b02fd16b8942a4cf6b6543d712cefeec2e4e29e6 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/hrtimer.h>
 #include <linux/ktime.h>
 #include <linux/string.h>
+#include <linux/net.h>
 
 #include <net/secure_seq.h>
 
@@ -16,18 +17,7 @@ static u32 net_secret[NET_SECRET_SIZE] ____cacheline_aligned;
 
 static void net_secret_init(void)
 {
-       u32 tmp;
-       int i;
-
-       if (likely(net_secret[0]))
-               return;
-
-       for (i = NET_SECRET_SIZE; i > 0;) {
-               do {
-                       get_random_bytes(&tmp, sizeof(tmp));
-               } while (!tmp);
-               cmpxchg(&net_secret[--i], 0, tmp);
-       }
+       net_get_random_once(net_secret, sizeof(net_secret));
 }
 
 #ifdef CONFIG_INET