summaryrefslogtreecommitdiffstats
path: root/crypto/evp/pmeth_lib.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2021-02-10 16:55:19 +0100
committerRichard Levitte <levitte@openssl.org>2021-02-23 13:41:47 +0100
commit6179dfc7c4bd850004c3b4b8220f3559573130d5 (patch)
tree145212e694a514211482e23912ae4cc976df5fe8 /crypto/evp/pmeth_lib.c
parentf627561cf5cc4963698bf975df8694543bcf826c (diff)
EVP: Implement EVP_PKEY_CTX_is_a()
This does what was previously done by looking at pctx->pmeth->pkey_id, but handles both legacy and provider side contexts, and is supposed to become a replacement for the old way. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13913)
Diffstat (limited to 'crypto/evp/pmeth_lib.c')
-rw-r--r--crypto/evp/pmeth_lib.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index a933752071..73f44c46cb 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -649,6 +649,15 @@ const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx)
}
#endif
+int EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype)
+{
+#ifndef FIPS_MODULE
+ if (evp_pkey_ctx_is_legacy(ctx))
+ return (ctx->pmeth->pkey_id == evp_pkey_name2type(keytype));
+#endif
+ return EVP_KEYMGMT_is_a(ctx->keymgmt, keytype);
+}
+
int EVP_PKEY_CTX_set_params(EVP_PKEY_CTX *ctx, OSSL_PARAM *params)
{
if (EVP_PKEY_CTX_IS_DERIVE_OP(ctx)