Stop marking default digest for EC keys as mandatory
authorDavid Woodhouse <dwmw2@infradead.org>
Tue, 16 Oct 2018 14:41:17 +0000 (07:41 -0700)
committerNicola Tuveri <nic.tuv@gmail.com>
Sat, 10 Nov 2018 01:23:14 +0000 (03:23 +0200)
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 <nic.tuv@gmail.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7408)

crypto/ec/ec_ameth.c

index a3164b5b2ed9743854f7a2c209a869f30d3d0151..8b363e096beda464ab5352467bc435006cf5f54a 100644 (file)
@@ -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);