summaryrefslogtreecommitdiff
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 66858104c..0908fcf11 100644
--- a/dh.c
+++ b/dh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh.c,v 1.45 2007/09/27 00:15:57 ray Exp $ */ 1/* $OpenBSD: dh.c,v 1.46 2008/04/13 00:22:17 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Niels Provos. All rights reserved. 3 * Copyright (c) 2000 Niels Provos. All rights reserved.
4 * 4 *
@@ -153,7 +153,7 @@ choose_dh(int min, int wantbits, int max)
153 } 153 }
154 154
155 linenum = 0; 155 linenum = 0;
156 which = arc4random() % bestcount; 156 which = arc4random_uniform(bestcount);
157 while (fgets(line, sizeof(line), f)) { 157 while (fgets(line, sizeof(line), f)) {
158 if (!parse_prime(linenum, line, &dhg)) 158 if (!parse_prime(linenum, line, &dhg))
159 continue; 159 continue;