diff options
author | djm <djm@openbsd.org> | 2008-04-13 00:22:16 +0000 |
---|---|---|
committer | djm <djm@openbsd.org> | 2008-04-13 00:22:16 +0000 |
commit | 66ad965f4873a0970dea06fb53c307b8385e5a94 (patch) | |
tree | 4afc515a23e6b6330f9c5d210162905120f9188a /usr.bin/ssh/dh.c | |
parent | bring in changes as found in libossaudio (diff) | |
download | wireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.tar.xz wireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.zip |
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.bin/ssh/dh.c')
-rw-r--r-- | usr.bin/ssh/dh.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index c658f745ef0..db8f0166df2 100644 --- a/usr.bin/ssh/dh.c +++ b/usr.bin/ssh/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.45 2007/09/27 00:15:57 ray Exp $ */ +/* $OpenBSD: dh.c,v 1.46 2008/04/13 00:22:17 djm Exp $ */ /* * Copyright (c) 2000 Niels Provos. All rights reserved. * @@ -150,7 +150,7 @@ choose_dh(int min, int wantbits, int max) } linenum = 0; - which = arc4random() % bestcount; + which = arc4random_uniform(bestcount); while (fgets(line, sizeof(line), f)) { if (!parse_prime(linenum, line, &dhg)) continue; |