diff options
author | Rich Salz <rsalz@akamai.com> | 2016-02-25 18:09:06 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-25 21:19:42 +0100 |
commit | 7c96dbcdab959fef74c4caae63cdebaa354ab252 (patch) | |
tree | af59789bb5bc85efd7e700d657db004910f8ba64 /crypto/evp/p_lib.c | |
parent | Fix unified build after CT reorg (diff) | |
download | openssl-7c96dbcdab959fef74c4caae63cdebaa354ab252.tar.xz openssl-7c96dbcdab959fef74c4caae63cdebaa354ab252.zip |
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/evp/p_lib.c')
-rw-r--r-- | crypto/evp/p_lib.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 221178dd31..b34a268c89 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -224,10 +224,8 @@ static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len) return 1; #ifndef OPENSSL_NO_ENGINE /* If we have an ENGINE release it */ - if (pkey->engine) { - ENGINE_finish(pkey->engine); - pkey->engine = NULL; - } + ENGINE_finish(pkey->engine); + pkey->engine = NULL; #endif } if (str) @@ -235,10 +233,10 @@ static int pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len) else ameth = EVP_PKEY_asn1_find(&e, type); #ifndef OPENSSL_NO_ENGINE - if (!pkey && e) + if (pkey == NULL) ENGINE_finish(e); #endif - if (!ameth) { + if (ameth == NULL) { EVPerr(EVP_F_PKEY_SET_TYPE, EVP_R_UNSUPPORTED_ALGORITHM); return 0; } @@ -396,8 +394,7 @@ int EVP_PKEY_type(int type) else ret = NID_undef; #ifndef OPENSSL_NO_ENGINE - if (e) - ENGINE_finish(e); + ENGINE_finish(e); #endif return ret; } @@ -437,10 +434,8 @@ static void EVP_PKEY_free_it(EVP_PKEY *x) x->pkey.ptr = NULL; } #ifndef OPENSSL_NO_ENGINE - if (x->engine) { - ENGINE_finish(x->engine); - x->engine = NULL; - } + ENGINE_finish(x->engine); + x->engine = NULL; #endif } |