diff options
author | Rich Salz <rsalz@akamai.com> | 2016-02-25 12:09:06 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-25 15:19:42 -0500 |
commit | 7c96dbcdab959fef74c4caae63cdebaa354ab252 (patch) | |
tree | af59789bb5bc85efd7e700d657db004910f8ba64 /crypto/dh | |
parent | 07b3ce8f8029f647c1babf0d8a03599885e7e284 (diff) | |
download | openssl-7c96dbcdab959fef74c4caae63cdebaa354ab252.tar.gz |
GH715: ENGINE_finish can take NULL
Simplifies calling code. Also fixed up any !ptr tests that were
nearby, turning them into NULL tests.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dh')
-rw-r--r-- | crypto/dh/dh_lib.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 9167d69ea8..58280d8734 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -88,10 +88,8 @@ int DH_set_method(DH *dh, const DH_METHOD *meth) if (mtmp->finish) mtmp->finish(dh); #ifndef OPENSSL_NO_ENGINE - if (dh->engine) { - ENGINE_finish(dh->engine); - dh->engine = NULL; - } + ENGINE_finish(dh->engine); + dh->engine = NULL; #endif dh->meth = meth; if (meth->init) @@ -126,7 +124,7 @@ DH *DH_new_method(ENGINE *engine) ret->engine = ENGINE_get_default_DH(); if (ret->engine) { ret->meth = ENGINE_get_DH(ret->engine); - if (!ret->meth) { + if (ret->meth == NULL) { DHerr(DH_F_DH_NEW_METHOD, ERR_R_ENGINE_LIB); ENGINE_finish(ret->engine); OPENSSL_free(ret); @@ -140,8 +138,7 @@ DH *DH_new_method(ENGINE *engine) CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); if ((ret->meth->init != NULL) && !ret->meth->init(ret)) { #ifndef OPENSSL_NO_ENGINE - if (ret->engine) - ENGINE_finish(ret->engine); + ENGINE_finish(ret->engine); #endif CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, ret, &ret->ex_data); OPENSSL_free(ret); @@ -165,8 +162,7 @@ void DH_free(DH *r) if (r->meth->finish) r->meth->finish(r); #ifndef OPENSSL_NO_ENGINE - if (r->engine) - ENGINE_finish(r->engine); + ENGINE_finish(r->engine); #endif CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data); |