summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_lib.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2016-02-25 12:09:06 -0500
committerRich Salz <rsalz@openssl.org>2016-02-25 15:19:42 -0500
commit7c96dbcdab959fef74c4caae63cdebaa354ab252 (patch)
treeaf59789bb5bc85efd7e700d657db004910f8ba64 /crypto/evp/p_lib.c
parent07b3ce8f8029f647c1babf0d8a03599885e7e284 (diff)
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.c19
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
}