From: David Woodhouse Date: Tue, 16 Oct 2018 14:41:17 +0000 (-0700) Subject: Stop marking default digest for EC keys as mandatory X-Git-Tag: openssl-3.0.0-alpha1~2921 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=eb7eb1378cd15c4652884b3701d4c0ef27b5b8a6;ds=sidebyside Stop marking default digest for EC keys as mandatory ASN1_PKEY_CTRL_DEFAULT_MD_NID is documented to return 2 for a mandatory digest algorithm, when the key can't support any others. That isn't true here, so return 1 instead. Partially fixes #7348 Reviewed-by: Nicola Tuveri Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/7408) --- diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index a3164b5b2e..8b363e096b 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -505,7 +505,7 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) case ASN1_PKEY_CTRL_DEFAULT_MD_NID: *(int *)arg2 = NID_sha256; - return 2; + return 1; case ASN1_PKEY_CTRL_SET1_TLS_ENCPT: return EC_KEY_oct2key(EVP_PKEY_get0_EC_KEY(pkey), arg2, arg1, NULL);