diff options
author | Richard Levitte <levitte@openssl.org> | 2020-01-08 03:44:28 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-01-17 09:04:04 +0100 |
commit | 6508e858836020622efff5dd4be3fa4530d1584b (patch) | |
tree | ec7f0d78108dadd5762d07cc373f67af5a931464 /crypto/evp/keymgmt_meth.c | |
parent | e4a1d0230016d090ba78bc7092384315f85b0e72 (diff) |
EVP: make EVP_PKEY_{bits,security_bits,size} work with provider only keys
These functions relied entirely on the presence of 'pkey->pmeth',
which is NULL on provider only keys. This adds an interface to get
domparam and key data from a provider, given corresponding provider
data (the actual domparam or key).
The retrieved data is cached in the EVP_PKEY structure (lending the
idea from provided EVP_CIPHER).
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/10778)
Diffstat (limited to 'crypto/evp/keymgmt_meth.c')
-rw-r--r-- | crypto/evp/keymgmt_meth.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/crypto/evp/keymgmt_meth.c b/crypto/evp/keymgmt_meth.c index 03d1686cf3..ae1f10e6b3 100644 --- a/crypto/evp/keymgmt_meth.c +++ b/crypto/evp/keymgmt_meth.c @@ -81,6 +81,16 @@ static void *keymgmt_from_dispatch(int name_id, keymgmt->exportdomparam_types = OSSL_get_OP_keymgmt_exportdomparam_types(fns); break; + case OSSL_FUNC_KEYMGMT_GET_DOMPARAM_PARAMS: + if (keymgmt->get_domparam_params == NULL) + keymgmt->get_domparam_params = + OSSL_get_OP_keymgmt_get_domparam_params(fns); + break; + case OSSL_FUNC_KEYMGMT_GETTABLE_DOMPARAM_PARAMS: + if (keymgmt->gettable_domparam_params == NULL) + keymgmt->gettable_domparam_params = + OSSL_get_OP_keymgmt_gettable_domparam_params(fns); + break; case OSSL_FUNC_KEYMGMT_IMPORTKEY: if (keymgmt->importkey != NULL) break; @@ -118,6 +128,16 @@ static void *keymgmt_from_dispatch(int name_id, keymgmt->exportkey_types = OSSL_get_OP_keymgmt_exportkey_types(fns); break; + case OSSL_FUNC_KEYMGMT_GET_KEY_PARAMS: + if (keymgmt->get_key_params == NULL) + keymgmt->get_key_params = + OSSL_get_OP_keymgmt_get_key_params(fns); + break; + case OSSL_FUNC_KEYMGMT_GETTABLE_KEY_PARAMS: + if (keymgmt->gettable_key_params == NULL) + keymgmt->gettable_key_params = + OSSL_get_OP_keymgmt_gettable_key_params(fns); + break; case OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME: if (keymgmt->query_operation_name != NULL) break; @@ -143,10 +163,14 @@ static void *keymgmt_from_dispatch(int name_id, && keymgmt->importdomparams == NULL) || (keymgmt->exportdomparam_types != NULL && keymgmt->exportdomparams == NULL) + || (keymgmt->gettable_domparam_params != NULL + && keymgmt->get_domparam_params == NULL) || (keymgmt->importkey_types != NULL && keymgmt->importkey == NULL) || (keymgmt->exportkey_types != NULL - && keymgmt->exportkey == NULL)) { + && keymgmt->exportkey == NULL) + || (keymgmt->gettable_key_params != NULL + && keymgmt->get_key_params == NULL)) { EVP_KEYMGMT_free(keymgmt); EVPerr(0, EVP_R_INVALID_PROVIDER_FUNCTIONS); return NULL; |