summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2017-10-09 14:37:21 +0100
committerDr. Stephen Henson <steve@openssl.org>2017-10-12 00:08:09 +0100
commita5d0541b1b07e2be305dadb0d01226ea58ff2994 (patch)
tree2563ec2519efbca84e24d9c0d1d0cf728be717c5 /crypto/evp
parent0cf65a0f5fdd72b950887e717f1f20d66ba30942 (diff)
Don't ignore passed ENGINE.
If we are passed an ENGINE to use in int_ctx_new e.g. via EVP_PKEY_CTX_new() use it instead of the default. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4503) (cherry picked from commit c2976edf4b22691d8bebb0e3ca2db18b3d0c71c6)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/pmeth_lib.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index b7f06be5df..877fbd072e 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -89,7 +89,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
id = pkey->ameth->pkey_id;
}
#ifndef OPENSSL_NO_ENGINE
- if (pkey && pkey->engine)
+ if (e == NULL && pkey != NULL)
e = pkey->engine;
/* Try to find an ENGINE which implements this method */
if (e) {
@@ -97,8 +97,9 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
EVPerr(EVP_F_INT_CTX_NEW, ERR_R_ENGINE_LIB);
return NULL;
}
- } else
+ } else {
e = ENGINE_get_pkey_meth_engine(id);
+ }
/*
* If an ENGINE handled this method look it up. Otherwise use internal