diff options
author | Richard Levitte <levitte@openssl.org> | 2020-02-05 12:53:14 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-03-02 03:27:03 +0100 |
commit | bee5d6cd3fa2f8bcc7e1153e4dc26aa26144bee0 (patch) | |
tree | 433108cf9e3f133fbc3423be1e10cf03b35f378f /crypto | |
parent | EVP: Adapt EVP_PKEY_missing_parameters() for provider keys (diff) | |
download | openssl-bee5d6cd3fa2f8bcc7e1153e4dc26aa26144bee0.tar.xz openssl-bee5d6cd3fa2f8bcc7e1153e4dc26aa26144bee0.zip |
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')
-rw-r--r-- | crypto/evp/evp_local.h | 1 | ||||
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index 9b4ab29fda..9d37dce20c 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -85,6 +85,7 @@ struct evp_keymgmt_st { OSSL_OP_keymgmt_query_operation_name_fn *query_operation_name; OSSL_OP_keymgmt_has_fn *has; OSSL_OP_keymgmt_validate_fn *validate; + OSSL_OP_keymgmt_match_fn *match; /* Import and export routines */ OSSL_OP_keymgmt_import_fn *import; 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[]) { |