summaryrefslogtreecommitdiff
path: root/crypto/evp/pmeth_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-01-15 11:10:43 +0000
committerMatt Caswell <matt@openssl.org>2020-01-27 08:45:17 +0000
commit2ee4a50ab92020dc49383d5aa644397edac4a59a (patch)
tree76af6ea9c9f93810d91929a42ef4b6b237cfaf1f /crypto/evp/pmeth_lib.c
parent612539e8a678c6099131dfd0e5e4b85fa774eb1a (diff)
downloadopenssl-new-2ee4a50ab92020dc49383d5aa644397edac4a59a.tar.gz
Modify EVP_PKEY_CTX_new_from_pkey() to add a propquery parameter
The function EVP_PKEY_CTX_new_from_pkey() infers the name of the algorithm to fetch from the EVP_PKEY that has been supplied as an argument. But there was no way to specify properties to be used during that fetch. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/10926)
Diffstat (limited to 'crypto/evp/pmeth_lib.c')
-rw-r--r--crypto/evp/pmeth_lib.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index e8bcb7e5a4..03d6ab4da4 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -186,17 +186,6 @@ static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
return NULL;
if (e == NULL)
name = OBJ_nid2sn(id);
- propquery = NULL;
- /*
- * We were called using legacy data, or an EVP_PKEY, but an EVP_PKEY
- * isn't tied to a specific library context, so we fall back to the
- * default library context.
- * TODO(v3.0): an EVP_PKEY that doesn't originate from a leagacy key
- * structure only has the pkeys[] cache, where the first element is
- * considered the "origin". Investigate if that could be a suitable
- * way to find a library context.
- */
- libctx = NULL;
# ifndef OPENSSL_NO_ENGINE
if (e == NULL && pkey != NULL)
@@ -269,9 +258,10 @@ EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OPENSSL_CTX *libctx,
return int_ctx_new(libctx, NULL, NULL, name, propquery, -1);
}
-EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OPENSSL_CTX *libctx, EVP_PKEY *pkey)
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OPENSSL_CTX *libctx, EVP_PKEY *pkey,
+ const char *propquery)
{
- return int_ctx_new(libctx, pkey, NULL, NULL, NULL, -1);
+ return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1);
}
void evp_pkey_ctx_free_old_ops(EVP_PKEY_CTX *ctx)