summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/softraid.c7
-rw-r--r--sys/net/if_spppsubr.c7
-rw-r--r--sys/netinet/ip_carp.c7
3 files changed, 7 insertions, 14 deletions
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index 8f209fdb8d7..23f99ef80cf 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.84 2007/09/11 13:39:33 gilles Exp $ */
+/* $OpenBSD: softraid.c,v 1.85 2007/11/16 05:08:39 djm Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -1754,10 +1754,7 @@ sr_checksum(char *s, u_int32_t *p, u_int32_t size)
void
sr_get_uuid(struct sr_uuid *uuid)
{
- int i;
-
- for (i = 0; i < SR_UUID_MAX; i++)
- uuid->sui_id[i] = arc4random();
+ arc4random_bytes(uuid->sui_id, sizeof(uuid->sui_id));
}
void
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 10dcd7215f9..566ad37e902 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.61 2007/11/01 03:35:43 deraadt Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.62 2007/11/16 05:08:39 djm Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
* Keepalive protocol implemented in both Cisco and PPP modes.
@@ -4063,10 +4063,7 @@ sppp_chap_scr(struct sppp *sp)
/* Compute random challenge. */
ch = (u_int32_t *)sp->myauth.challenge;
- ch[0] = arc4random();
- ch[1] = arc4random();
- ch[2] = arc4random();
- ch[3] = arc4random();
+ arc4random_bytes(ch, sizeof(*ch) * 4);
clen = AUTHKEYLEN;
sp->confid[IDX_CHAP] = ++sp->pp_seq;
diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index ddb0d21323c..db6ab897d4a 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_carp.c,v 1.153 2007/10/29 16:19:23 chl Exp $ */
+/* $OpenBSD: ip_carp.c,v 1.154 2007/11/16 05:08:39 djm Exp $ */
/*
* Copyright (c) 2002 Michael Shalayeff. All rights reserved.
@@ -908,9 +908,8 @@ int
carp_prepare_ad(struct mbuf *m, struct carp_softc *sc, struct carp_header *ch)
{
if (!sc->sc_replay_cookie) {
- sc->sc_replay_cookie = arc4random();
- sc->sc_replay_cookie = sc->sc_replay_cookie << 32;
- sc->sc_replay_cookie += arc4random();
+ arc4random_bytes(&sc->sc_replay_cookie,
+ sizeof(sc->sc_replay_cookie));
}
bcopy(&sc->sc_replay_cookie, ch->carp_counter,