aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dh
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2000-11-29 19:59:45 +0000
committerGeoff Thorpe <geoff@openssl.org>2000-11-29 19:59:45 +0000
commitd50f1bdfac5c985291e5075018373567b05e6edb (patch)
tree8a5cb8cea83164b904c892e9bb65775118987f2a /crypto/dh
parent38b40c624c2fe3f95862c81b39875c44dbd2bc80 (diff)
downloadopenssl-d50f1bdfac5c985291e5075018373567b05e6edb.tar.gz
Do to DH and DSA what has already been done to RSA. This involves moving
the initialisation and cleanup of "ex_data" elements to before an init() handler and after a finish() handler respectively.
Diffstat (limited to 'crypto/dh')
-rw-r--r--crypto/dh/dh_lib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index fcb8142348..c0a2472751 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -168,13 +168,13 @@ DH *DH_new_method(ENGINE *engine)
ret->method_mont_p=NULL;
ret->references = 1;
ret->flags=meth->flags;
+ CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data);
if ((meth->init != NULL) && !meth->init(ret))
{
+ CRYPTO_free_ex_data(dh_meth,ret,&ret->ex_data);
OPENSSL_free(ret);
ret=NULL;
}
- else
- CRYPTO_new_ex_data(dh_meth,ret,&ret->ex_data);
return(ret);
}
@@ -196,12 +196,12 @@ void DH_free(DH *r)
}
#endif
- CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
-
meth = ENGINE_get_DH(r->engine);
if(meth->finish) meth->finish(r);
ENGINE_finish(r->engine);
+ CRYPTO_free_ex_data(dh_meth, r, &r->ex_data);
+
if (r->p != NULL) BN_clear_free(r->p);
if (r->g != NULL) BN_clear_free(r->g);
if (r->q != NULL) BN_clear_free(r->q);