summaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2001-07-27 22:45:35 +0000
committerBodo Möller <bodo@openssl.org>2001-07-27 22:45:35 +0000
commitde3333bae446a185180287382b8abf25c4bac228 (patch)
tree6e0c8a6a72cba9e291caa91d0ec8d1f9b52fe6e4 /crypto/dh
parent924875e53bda2ea5057070c9365ee5c0b3f0d6d5 (diff)
length of secret exponent is needed only when we create one
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_key.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c
index 4a2b75a992..670727798e 100644
--- a/crypto/dh/dh_key.c
+++ b/crypto/dh/dh_key.c
@@ -135,10 +135,9 @@ static int generate_key(DH *dh)
}
mont=(BN_MONT_CTX *)dh->method_mont_p;
- l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */
-
if (generate_new_key)
{
+ l = dh->length ? dh->length : BN_num_bits(dh->p)-1; /* secret exponent length */
if (!BN_rand(priv_key, l, 0, 0)) goto err;
}
if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, pub_key, dh->g,