summaryrefslogtreecommitdiffstats
path: root/crypto/evp/keymgmt_meth.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-02-05 12:53:14 +0100
committerRichard Levitte <levitte@openssl.org>2020-03-02 03:27:03 +0100
commitbee5d6cd3fa2f8bcc7e1153e4dc26aa26144bee0 (patch)
tree433108cf9e3f133fbc3423be1e10cf03b35f378f /crypto/evp/keymgmt_meth.c
parent157ded39ee68c1c00814165f79f9b2f000996884 (diff)
KEYMGMT: Add a keydata matching function
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11158)
Diffstat (limited to 'crypto/evp/keymgmt_meth.c')
-rw-r--r--crypto/evp/keymgmt_meth.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c
index 3fcc073a5a..9dd53f9dc2 100644
--- a/crypto/evp/keymgmt_meth.c
+++ b/crypto/evp/keymgmt_meth.c
@@ -95,6 +95,10 @@ static void *keymgmt_from_dispatch(int name_id,
if (keymgmt->validate == NULL)
keymgmt->validate = OSSL_get_OP_keymgmt_validate(fns);
break;
+ case OSSL_FUNC_KEYMGMT_MATCH:
+ if (keymgmt->match == NULL)
+ keymgmt->match = OSSL_get_OP_keymgmt_match(fns);
+ break;
case OSSL_FUNC_KEYMGMT_IMPORT:
if (keymgmt->import == NULL) {
importfncnt++;
@@ -290,6 +294,16 @@ int evp_keymgmt_validate(const EVP_KEYMGMT *keymgmt, void *keydata,
return keymgmt->validate(keydata, selection);
}
+int evp_keymgmt_match(const EVP_KEYMGMT *keymgmt,
+ const void *keydata1, const void *keydata2,
+ int selection)
+{
+ /* We assume no match if the implementation doesn't have a function */
+ if (keymgmt->match == NULL)
+ return 0;
+ return keymgmt->match(keydata1, keydata2, selection);
+}
+
int evp_keymgmt_import(const EVP_KEYMGMT *keymgmt, void *keydata,
int selection, const OSSL_PARAM params[])
{