summaryrefslogtreecommitdiffstats
path: root/dh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2008-05-19 14:50:00 +1000
committerDamien Miller <djm@mindrot.org>2008-05-19 14:50:00 +1000
commit354c48c641e7fbdc273ee8e1239ff71d73a1ec3e (patch)
treeab82abcf3687b6433990584ac62f89132c73db4b /dh.c
parenta4be7c23fdcf8a1da5420068dc4bd4db45af9c9c (diff)
- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2008/04/13 00:22:17 [dh.c sshd.c] 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 'dh.c')
-rw-r--r--dh.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/dh.c b/dh.c
index 66858104..0908fcf1 100644
--- a/dh.c
+++ b/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.
*
@@ -153,7 +153,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;