diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
commit | f15cc9e98f102b443a7b1bc97ce7b524d3453c7e (patch) | |
tree | cd34ef18f375e585b2843c566e08b7a49da49084 /usr.sbin/ntpd | |
parent | dd3e3e68352b843aef5b3347835e71e9f26a0d92 (diff) |
Use arc4random_buf() when requesting more than a single word of output
Use arc4random_uniform() when the desired random number upper bound
is not a power of two
ok deraadt@ millert@
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 28234875813..7026a9ba548 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.103 2008/01/28 11:45:59 mpf Exp $ */ +/* $OpenBSD: ntp.c,v 1.104 2008/04/13 00:22:17 djm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -659,7 +659,7 @@ scale_interval(time_t requested) time_t interval, r; interval = requested * conf->scale; - r = arc4random() % MAX(5, interval / 10); + r = arc4random_uniform(MAX(5, interval / 10)); return (interval + r); } @@ -669,7 +669,7 @@ error_interval(void) time_t interval, r; interval = INTERVAL_QUERY_PATHETIC * QSCALE_OFF_MAX / QSCALE_OFF_MIN; - r = arc4random() % (interval / 10); + r = arc4random_uniform(interval / 10); return (interval + r); } |