aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHannes Frederic Sowa <hannes@stressinduktion.org>2013-10-19 21:48:59 +0200
committerDavid S. Miller <davem@davemloft.net>2013-10-19 19:45:36 -0400
commite34c9a69970d8664a36b46e6445a7cc879111cfd (patch)
tree68768a3e760a90b2b13a8e7a83d573c0e63a4a35 /net
parenttcp: switch tcp_fastopen key generation to net_get_random_once (diff)
downloadlinux-dev-e34c9a69970d8664a36b46e6445a7cc879111cfd.tar.xz
linux-dev-e34c9a69970d8664a36b46e6445a7cc879111cfd.zip
net: switch net_secret key generation to net_get_random_once
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>
Diffstat (limited to 'net')
-rw-r--r--net/core/secure_seq.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
index 3f1ec1586ae1..b02fd16b8942 100644
--- a/net/core/secure_seq.c
+++ b/net/core/secure_seq.c
@@ -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