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 /include/crypto/evp.h | |
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 'include/crypto/evp.h')
-rw-r--r-- | include/crypto/evp.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/crypto/evp.h b/include/crypto/evp.h index 91f535093d..b3d1f7d21c 100644 --- a/include/crypto/evp.h +++ b/include/crypto/evp.h @@ -565,6 +565,13 @@ struct evp_pkey_st { * a copy of that key's dirty count. */ size_t dirty_cnt_copy; + + /* Cache of domain parameter / key information */ + struct { + int bits; + int security_bits; + int size; + } cache; } /* EVP_PKEY */ ; #define EVP_PKEY_CTX_IS_SIGNATURE_OP(ctx) \ @@ -590,6 +597,8 @@ void evp_app_cleanup_int(void); void *evp_keymgmt_export_to_provider(EVP_PKEY *pk, EVP_KEYMGMT *keymgmt, int domainparams); void evp_keymgmt_clear_pkey_cache(EVP_PKEY *pk); +void evp_keymgmt_cache_pkey(EVP_PKEY *pk, size_t index, EVP_KEYMGMT *keymgmt, + void *provdata, int domainparams); void *evp_keymgmt_fromdata(EVP_PKEY *target, EVP_KEYMGMT *keymgmt, const OSSL_PARAM params[], int domainparams); @@ -608,6 +617,10 @@ const OSSL_PARAM * evp_keymgmt_importdomparam_types(const EVP_KEYMGMT *keymgmt); const OSSL_PARAM * evp_keymgmt_exportdomparam_types(const EVP_KEYMGMT *keymgmt); +int evp_keymgmt_get_domparam_params(const EVP_KEYMGMT *keymgmt, + void *provdomparam, OSSL_PARAM params[]); +const OSSL_PARAM * +evp_keymgmt_gettable_domparam_params(const EVP_KEYMGMT *keymgmt); void *evp_keymgmt_importkey(const EVP_KEYMGMT *keymgmt, const OSSL_PARAM params[]); @@ -620,6 +633,9 @@ int evp_keymgmt_exportkey(const EVP_KEYMGMT *keymgmt, void *provkey, OSSL_CALLBACK *param_cb, void *cbarg); const OSSL_PARAM *evp_keymgmt_importkey_types(const EVP_KEYMGMT *keymgmt); const OSSL_PARAM *evp_keymgmt_exportkey_types(const EVP_KEYMGMT *keymgmt); +int evp_keymgmt_get_key_params(const EVP_KEYMGMT *keymgmt, + void *provkey, OSSL_PARAM params[]); +const OSSL_PARAM *evp_keymgmt_gettable_key_params(const EVP_KEYMGMT *keymgmt); /* Pulling defines out of C source files */ |