summaryrefslogtreecommitdiff
path: root/dh.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-02-29 20:15:08 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-02-29 20:15:08 +1100
commiteffc84ce5b304a0cef62b13e72172847b6f03ceb (patch)
tree5951f0739084239587667b6a58538906d20ab33e /dh.c
parentc56c7ef592e9dded048faa1443049679aacc0421 (diff)
- dtucker@cvs.openbsd.org 2004/02/27 22:49:27
[dh.c] Reset bit counter at the right time, fixes debug output in the case where the DH group is rejected. ok markus@
Diffstat (limited to 'dh.c')
-rw-r--r--dh.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/dh.c b/dh.c
index 0790aff79..afd1e05d0 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: dh.c,v 1.28 2004/02/27 22:44:56 dtucker Exp $"); 26RCSID("$OpenBSD: dh.c,v 1.29 2004/02/27 22:49:27 dtucker Exp $");
27 27
28#include "xmalloc.h" 28#include "xmalloc.h"
29 29
@@ -197,7 +197,7 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
197void 197void
198dh_gen_key(DH *dh, int need) 198dh_gen_key(DH *dh, int need)
199{ 199{
200 int i, bits_set = 0, tries = 0; 200 int i, bits_set, tries = 0;
201 201
202 if (dh->p == NULL) 202 if (dh->p == NULL)
203 fatal("dh_gen_key: dh->p == NULL"); 203 fatal("dh_gen_key: dh->p == NULL");
@@ -214,7 +214,7 @@ dh_gen_key(DH *dh, int need)
214 fatal("dh_gen_key: BN_rand failed"); 214 fatal("dh_gen_key: BN_rand failed");
215 if (DH_generate_key(dh) == 0) 215 if (DH_generate_key(dh) == 0)
216 fatal("DH_generate_key"); 216 fatal("DH_generate_key");
217 for (i = 0; i <= BN_num_bits(dh->priv_key); i++) 217 for (i = 0, bits_set = 0; i <= BN_num_bits(dh->priv_key); i++)
218 if (BN_is_bit_set(dh->priv_key, i)) 218 if (BN_is_bit_set(dh->priv_key, i))
219 bits_set++; 219 bits_set++;
220 debug2("dh_gen_key: priv key bits set: %d/%d", 220 debug2("dh_gen_key: priv key bits set: %d/%d",