summaryrefslogtreecommitdiff
path: root/sys/net/if_spppsubr.c
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>2004-06-22 02:02:46 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>2004-06-22 02:02:46 +0000
commitc5f5599920edba2aa44d64f61db1ab75d592cf3d (patch)
treefd21c8ffc1e7adc6b3655ffcc6cfdd8d4e2cba0d /sys/net/if_spppsubr.c
parent8b32c325ee92af9acc675d6382c7a492cecbb813 (diff)
Don't use time-based random number generation
ok millert@ deraadt@
Diffstat (limited to 'sys/net/if_spppsubr.c')
-rw-r--r--sys/net/if_spppsubr.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c
index 4b3c96c0a6b..2da5396c5f2 100644
--- a/sys/net/if_spppsubr.c
+++ b/sys/net/if_spppsubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_spppsubr.c,v 1.21 2004/05/07 14:42:27 millert Exp $ */
+/* $OpenBSD: if_spppsubr.c,v 1.22 2004/06/22 02:02:45 tholo Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
* Keepalive protocol implemented in both Cisco and PPP modes.
@@ -3386,24 +3386,15 @@ sppp_chap_tld(struct sppp *sp)
HIDE void
sppp_chap_scr(struct sppp *sp)
{
- u_long *ch, seed;
+ u_int32_t *ch;
u_char clen;
-#if defined (__NetBSD__) || defined (__OpenBSD__)
- struct timeval tv;
-#endif
/* Compute random challenge. */
- ch = (u_long *)sp->myauth.challenge;
-#if defined (__FreeBSD__)
- read_random(&seed, sizeof seed);
-#else
- microtime(&tv);
- seed = tv.tv_sec ^ tv.tv_usec;
-#endif
- ch[0] = seed ^ random();
- ch[1] = seed ^ random();
- ch[2] = seed ^ random();
- ch[3] = seed ^ random();
+ ch = (u_int32_t *)sp->myauth.challenge;
+ ch[0] = arc4random();
+ ch[1] = arc4random();
+ ch[2] = arc4random();
+ ch[3] = arc4random();
clen = AUTHKEYLEN;
sp->confid[IDX_CHAP] = ++sp->pp_seq;