diff options
author | Richard Levitte <levitte@openssl.org> | 2020-07-08 22:21:18 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-07-24 16:32:00 +0200 |
commit | 5dacb38ccefd45d832c9710b4dd0121fdcbdac72 (patch) | |
tree | fccb9bbd4fdf791d6461dedb1f26b163fe0b37a4 /crypto/evp/keymgmt_meth.c | |
parent | af836c22cede6bd89c0b35c13d17e95f1854c5d0 (diff) |
KEYMGMT: Add key loading function OSSL_FUNC_keymgmt_load()
This function is used to create a keydata for a key that libcrypto
only has a reference to.
This introduces provider references, the contents which only the
provider know how to interpret. Outside of the provider, this is just
an array of bytes.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12410)
Diffstat (limited to 'crypto/evp/keymgmt_meth.c')
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index 7847b98380..47067dd6c7 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -89,6 +89,10 @@ static void *keymgmt_from_dispatch(int name_id, if (keymgmt->free == NULL) keymgmt->free = OSSL_FUNC_keymgmt_free(fns); break; + case OSSL_FUNC_KEYMGMT_LOAD: + if (keymgmt->load == NULL) + keymgmt->load = OSSL_FUNC_keymgmt_load(fns); + break; case OSSL_FUNC_KEYMGMT_GET_PARAMS: if (keymgmt->get_params == NULL) { getparamfncnt++; @@ -171,7 +175,9 @@ static void *keymgmt_from_dispatch(int name_id, * export if you can't import or export. */ if (keymgmt->free == NULL - || (keymgmt->new == NULL && keymgmt->gen == NULL) + || (keymgmt->new == NULL + && keymgmt->gen == NULL + && keymgmt->load == NULL) || keymgmt->has == NULL || (getparamfncnt != 0 && getparamfncnt != 2) || (setparamfncnt != 0 && setparamfncnt != 2) @@ -345,6 +351,14 @@ void evp_keymgmt_gen_cleanup(const EVP_KEYMGMT *keymgmt, void *genctx) keymgmt->gen_cleanup(genctx); } +void *evp_keymgmt_load(const EVP_KEYMGMT *keymgmt, + const void *objref, size_t objref_sz) +{ + if (keymgmt->load != NULL) + return keymgmt->load(objref, objref_sz); + return NULL; +} + int evp_keymgmt_get_params(const EVP_KEYMGMT *keymgmt, void *keydata, OSSL_PARAM params[]) { |