diff options
author | Richard Levitte <levitte@openssl.org> | 2021-09-30 17:40:16 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-10-27 12:46:15 +0200 |
commit | 026ed4d73369e603ab1606c1aa29b53a7a1a876c (patch) | |
tree | fa295197a7230e26065f5fe673d5e81408f7c783 | |
parent | 6853bfc9ccd9583c47b3fb17f40b39ff11c19524 (diff) |
EVP: Add evp_keymgmt_fetch_from_prov()
This is an internal function to fetch a keymgmt method from a specific
provider.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16725)
(cherry picked from commit 33561e0d5b89a06d1c03b952196d008b5014914a)
-rw-r--r-- | crypto/evp/evp_local.h | 3 | ||||
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index 58c5759120..345bd173c1 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -298,6 +298,9 @@ void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id, /* Internal fetchers for method types that are to be combined with others */ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id, const char *properties); +EVP_KEYMGMT *evp_keymgmt_fetch_from_prov(OSSL_PROVIDER *prov, + const char *name, + const char *properties); /* Internal structure constructors for fetched methods */ EVP_MD *evp_md_new(void); diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index 47a0350cc2..fb999c7fd0 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -213,6 +213,17 @@ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id, (void (*)(void *))EVP_KEYMGMT_free); } +EVP_KEYMGMT *evp_keymgmt_fetch_from_prov(OSSL_PROVIDER *prov, + const char *name, + const char *properties) +{ + return evp_generic_fetch_from_prov(prov, OSSL_OP_KEYMGMT, + name, properties, + keymgmt_from_algorithm, + (int (*)(void *))EVP_KEYMGMT_up_ref, + (void (*)(void *))EVP_KEYMGMT_free); +} + EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm, const char *properties) { |