diff options
author | Bodo Möller <bodo@openssl.org> | 2001-07-27 22:34:25 +0000 |
---|---|---|
committer | Bodo Möller <bodo@openssl.org> | 2001-07-27 22:34:25 +0000 |
commit | 924875e53bda2ea5057070c9365ee5c0b3f0d6d5 (patch) | |
tree | 2bcd370740a024fbe3b75a20e27144bac80f7ef4 /crypto | |
parent | 3a6445821712cacc68924838f48873e7dca77280 (diff) |
Undo DH_generate_key() change: s3_srvr.c was using it correctly
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/dh/dh_key.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/dh/dh_key.c b/crypto/dh/dh_key.c index df0300402e..4a2b75a992 100644 --- a/crypto/dh/dh_key.c +++ b/crypto/dh/dh_key.c @@ -101,6 +101,7 @@ const DH_METHOD *DH_OpenSSL(void) static int generate_key(DH *dh) { int ok=0; + int generate_new_key=0; unsigned l; BN_CTX *ctx; BN_MONT_CTX *mont; @@ -113,6 +114,7 @@ static int generate_key(DH *dh) { priv_key=BN_new(); if (priv_key == NULL) goto err; + generate_new_key=1; } else priv_key=dh->priv_key; @@ -135,7 +137,10 @@ static int generate_key(DH *dh) 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 (generate_new_key) + { + if (!BN_rand(priv_key, l, 0, 0)) goto err; + } if (!ENGINE_get_DH(dh->engine)->bn_mod_exp(dh, pub_key, dh->g, priv_key,dh->p,ctx,mont)) goto err; |