diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 3b64b9f5cafa..a5345b0aa7cd 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.141 2002/05/07 02:59:38 matt Exp $ */ +/* $NetBSD: tcp_input.c,v 1.142 2002/05/28 10:11:51 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.141 2002/05/07 02:59:38 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.142 2002/05/28 10:11:51 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -2811,8 +2811,8 @@ syn_cache_insert(sc, tp) if (syn_cache_count == 0) { struct timeval tv; microtime(&tv); - syn_hash1 = random() ^ (u_long)≻ - syn_hash2 = random() ^ tv.tv_usec; + syn_hash1 = arc4random() ^ (u_long)≻ + syn_hash2 = arc4random() ^ tv.tv_usec; } SYN_HASHALL(sc->sc_hash, &sc->sc_src.sa, &sc->sc_dst.sa); diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 6f26933f5411..1c2a243e27f1 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $NetBSD: frag6.c,v 1.18 2002/05/28 03:04:05 itojun Exp $ */ +/* $NetBSD: frag6.c,v 1.19 2002/05/28 10:11:50 itojun Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.18 2002/05/28 03:04:05 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: frag6.c,v 1.19 2002/05/28 10:11:50 itojun Exp $"); #include #include @@ -139,14 +139,8 @@ do { \ void frag6_init() { - struct timeval tv; - /* - * in many cases, random() here does NOT return random number - * as initialization during bootstrap time occur in fixed order. - */ - microtime(&tv); - ip6_id = random() ^ tv.tv_usec; + ip6_id = arc4random(); ip6q.ip6q_next = ip6q.ip6q_prev = &ip6q; } diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index c5e15407eef0..a03bafb7c9e7 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.53 2002/05/28 03:04:06 itojun Exp $ */ +/* $NetBSD: ip6_input.c,v 1.54 2002/05/28 10:11:51 itojun Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.53 2002/05/28 03:04:06 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.54 2002/05/28 10:11:51 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -160,7 +160,6 @@ ip6_init() { struct ip6protosw *pr; int i; - struct timeval tv; pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); if (pr == 0) @@ -175,12 +174,7 @@ ip6_init() ip6intrq.ifq_maxlen = ip6qmaxlen; nd6_init(); frag6_init(); - /* - * in many cases, random() here does NOT return random number - * as initialization during bootstrap time occur in fixed order. - */ - microtime(&tv); - ip6_flow_seq = random() ^ tv.tv_usec; + ip6_flow_seq = arc4random(); ip6_init2((void *)0); diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index daad5321e81d..69336980dc4a 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $NetBSD: nd6_nbr.c,v 1.34 2002/03/15 09:36:27 itojun Exp $ */ +/* $NetBSD: nd6_nbr.c,v 1.35 2002/05/28 10:11:51 itojun Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.34 2002/03/15 09:36:27 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.35 2002/05/28 10:11:51 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -1099,9 +1099,9 @@ nd6_dad_start(ifa, tick) int ntick; if (*tick == 0) - ntick = random() % (MAX_RTR_SOLICITATION_DELAY * hz); + ntick = arc4random() % (MAX_RTR_SOLICITATION_DELAY * hz); else - ntick = *tick + random() % (hz / 2); + ntick = *tick + arc4random() % (hz / 2); *tick = ntick; nd6_dad_starttimer(dp, ntick); } diff --git a/sys/netkey/key.c b/sys/netkey/key.c index b4b15cbb4120..92d0918a5b95 100644 --- a/sys/netkey/key.c +++ b/sys/netkey/key.c @@ -1,4 +1,4 @@ -/* $NetBSD: key.c,v 1.63 2002/05/19 08:22:12 itojun Exp $ */ +/* $NetBSD: key.c,v 1.64 2002/05/28 10:11:49 itojun Exp $ */ /* $KAME: key.c,v 1.234 2002/05/13 03:21:17 itojun Exp $ */ /* @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.63 2002/05/19 08:22:12 itojun Exp $"); +__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.64 2002/05/28 10:11:49 itojun Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -4309,13 +4309,6 @@ key_timehandler(arg) static void key_srandom() { - struct timeval tv; - int i; - - microtime(&tv); - - for (i = (int)((tv.tv_sec ^ tv.tv_usec) & 0x3ff); i > 0; i--) - (void)random(); return; }