summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2004-02-27 22:49:28 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2004-02-27 22:49:28 +0000
commit09efca3a3af4b0318328b0cfc72437f155472938 (patch)
treee49958f5582a14627b45d0de57a4e9d2999e0f0b
parent8834cdbf6e70b1542a69be5b2a4b6516bda4cce7 (diff)
Reset bit counter at the right time, fixes debug output in the case where
the DH group is rejected. ok markus@
-rw-r--r--usr.bin/ssh/dh.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c
index 0790aff79b0..afd1e05d001 100644
--- a/usr.bin/ssh/dh.c
+++ b/usr.bin/ssh/dh.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: dh.c,v 1.28 2004/02/27 22:44:56 dtucker Exp $");
+RCSID("$OpenBSD: dh.c,v 1.29 2004/02/27 22:49:27 dtucker Exp $");
#include "xmalloc.h"
@@ -197,7 +197,7 @@ dh_pub_is_valid(DH *dh, BIGNUM *dh_pub)
void
dh_gen_key(DH *dh, int need)
{
- int i, bits_set = 0, tries = 0;
+ int i, bits_set, tries = 0;
if (dh->p == NULL)
fatal("dh_gen_key: dh->p == NULL");
@@ -214,7 +214,7 @@ dh_gen_key(DH *dh, int need)
fatal("dh_gen_key: BN_rand failed");
if (DH_generate_key(dh) == 0)
fatal("DH_generate_key");
- for (i = 0; i <= BN_num_bits(dh->priv_key); i++)
+ for (i = 0, bits_set = 0; i <= BN_num_bits(dh->priv_key); i++)
if (BN_is_bit_set(dh->priv_key, i))
bits_set++;
debug2("dh_gen_key: priv key bits set: %d/%d",