aboutsummaryrefslogtreecommitdiff
path: root/providers
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-04-20 21:35:03 +0200
committerMatt Caswell <matt@openssl.org>2020-04-23 10:44:37 +0100
commitaa45c4a9d35a8082c7ba326c19b97200001c9d82 (patch)
tree31dc65780cbbaedd3f1eb240a9b94057f9161fff /providers
parent1a7328c8825627f723be624ddbc7e5bfb40f8fd5 (diff)
downloadopenssl-aa45c4a9d35a8082c7ba326c19b97200001c9d82.zip
openssl-aa45c4a9d35a8082c7ba326c19b97200001c9d82.tar.gz
openssl-aa45c4a9d35a8082c7ba326c19b97200001c9d82.tar.bz2
PROV: Ensure that EC keys have a default digest
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11576)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/keymgmt/ec_kmgmt.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c
index 467004c..9466b4f 100644
--- a/providers/implementations/keymgmt/ec_kmgmt.c
+++ b/providers/implementations/keymgmt/ec_kmgmt.c
@@ -49,6 +49,7 @@ static OSSL_OP_keymgmt_export_fn ec_export;
static OSSL_OP_keymgmt_export_types_fn ec_export_types;
static OSSL_OP_keymgmt_query_operation_name_fn ec_query_operation_name;
+#define EC_DEFAULT_MD "SHA256"
#define EC_POSSIBLE_SELECTIONS \
(OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS)
@@ -491,6 +492,10 @@ int ec_get_params(void *key, OSSL_PARAM params[])
return 0;
}
+ if ((p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_DEFAULT_DIGEST)) != NULL
+ && !OSSL_PARAM_set_utf8_string(p, EC_DEFAULT_MD))
+ return 0;
+
p = OSSL_PARAM_locate(params, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH);
if (p != NULL) {
int ecdh_cofactor_mode = 0;