diff options
author | 2013-08-24 10:46:48 +0000 | |
---|---|---|
committer | 2013-08-24 10:46:48 +0000 | |
commit | 9ce3ea756c876cb96e896124dc58f3c83a1ff9e7 (patch) | |
tree | dfb06f45369352b4a04da46f18003fc2046c0a69 | |
parent | netnatm is no more (diff) | |
download | wireguard-openbsd-9ce3ea756c876cb96e896124dc58f3c83a1ff9e7.tar.xz wireguard-openbsd-9ce3ea756c876cb96e896124dc58f3c83a1ff9e7.zip |
replace random() with arc4random.
blambert didnt like stuff linking to libevent getting warnings about use of
an unsafe api.
ok blambert@ mikeb@ deraadt@ millert@
-rw-r--r-- | lib/libevent/poll.c | 4 | ||||
-rw-r--r-- | lib/libevent/select.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/libevent/poll.c b/lib/libevent/poll.c index 3ce103681b6..90180e1b32e 100644 --- a/lib/libevent/poll.c +++ b/lib/libevent/poll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: poll.c,v 1.15 2010/04/21 20:02:40 nicm Exp $ */ +/* $OpenBSD: poll.c,v 1.16 2013/08/24 10:46:48 dlg Exp $ */ /* * Copyright 2000-2003 Niels Provos <provos@citi.umich.edu> @@ -163,7 +163,7 @@ poll_dispatch(struct event_base *base, void *arg, struct timeval *tv) if (res == 0 || nfds == 0) return (0); - i = random() % nfds; + i = arc4random_uniform(nfds); for (j = 0; j < nfds; j++) { struct event *r_ev = NULL, *w_ev = NULL; int what; diff --git a/lib/libevent/select.c b/lib/libevent/select.c index 4e0c2b2a2b2..b87dcf929dd 100644 --- a/lib/libevent/select.c +++ b/lib/libevent/select.c @@ -1,4 +1,4 @@ -/* $OpenBSD: select.c,v 1.16 2010/04/21 21:02:47 nicm Exp $ */ +/* $OpenBSD: select.c,v 1.17 2013/08/24 10:46:48 dlg Exp $ */ /* * Copyright 2000-2002 Niels Provos <provos@citi.umich.edu> @@ -175,7 +175,7 @@ select_dispatch(struct event_base *base, void *arg, struct timeval *tv) event_debug(("%s: select reports %d", __func__, res)); check_selectop(sop); - i = random() % (sop->event_fds+1); + i = arc4random_uniform(sop->event_fds + 1); for (j = 0; j <= sop->event_fds; ++j) { struct event *r_ev = NULL, *w_ev = NULL; if (++i >= sop->event_fds+1) |