From 6508e858836020622efff5dd4be3fa4530d1584b Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 8 Jan 2020 03:44:28 +0100 Subject: 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 (Merged from https://github.com/openssl/openssl/pull/10778) --- include/openssl/core_names.h | 5 +++++ include/openssl/core_numbers.h | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'include/openssl') diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index 0bc51b3..a347d96 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -154,6 +154,11 @@ extern "C" { #define OSSL_KDF_NAME_KRB5KDF "KRB5KDF" /* PKEY parameters */ +/* Common PKEY parameters */ +#define OSSL_PKEY_PARAM_BITS "bits" /* integer */ +#define OSSL_PKEY_PARAM_MAX_SIZE "max-size" /* integer */ +#define OSSL_PKEY_PARAM_SECURITY_BITS "security-bits" /* integer */ + /* Diffie-Hellman/DSA Parameters */ #define OSSL_PKEY_PARAM_FFC_P "p" #define OSSL_PKEY_PARAM_FFC_G "g" diff --git a/include/openssl/core_numbers.h b/include/openssl/core_numbers.h index f41f7c0..0a809de 100644 --- a/include/openssl/core_numbers.h +++ b/include/openssl/core_numbers.h @@ -371,6 +371,14 @@ OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importdomparam_types, OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportdomparam_types, (void)) +/* Key domain parameter information */ +#define OSSL_FUNC_KEYMGMT_GET_DOMPARAM_PARAMS 7 +#define OSSL_FUNC_KEYMGMT_GETTABLE_DOMPARAM_PARAMS 8 +OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_domparam_params, + (void *domparam, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_domparam_params, + (void)) + /* Key creation and destruction */ # define OSSL_FUNC_KEYMGMT_IMPORTKEY 10 # define OSSL_FUNC_KEYMGMT_GENKEY 11 @@ -400,8 +408,15 @@ OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_exportkey, OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importkey_types, (void)) OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportkey_types, (void)) +/* Key information */ +#define OSSL_FUNC_KEYMGMT_GET_KEY_PARAMS 17 +#define OSSL_FUNC_KEYMGMT_GETTABLE_KEY_PARAMS 18 +OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_key_params, + (void *key, OSSL_PARAM params[])) +OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_key_params, (void)) + /* Discovery of supported operations */ -# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 17 +# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 20 OSSL_CORE_MAKE_FUNC(const char *,OP_keymgmt_query_operation_name, (int operation_id)) -- cgit v1.1