From 3e3cc9d4a79b05501d47615683869dc9e0e685e0 Mon Sep 17 00:00:00 2001 From: Zhi Guan Date: Wed, 19 Dec 2018 12:09:23 +0800 Subject: [PATCH] Update ec lib --- crypto/ec/ec_ameth.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 8aeaa21d..a225ee68 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -499,6 +499,12 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) #endif case ASN1_PKEY_CTRL_DEFAULT_MD_NID: +#if !defined(OPENSSL_NO_SM2) && !defined(OPENSSL_NO_SM3) + if (EC_KEY_is_sm2p256v1(EVP_PKEY_get0_EC_KEY(pkey))) { + *(int *)arg2 = NID_sm3; + return 2; + } +#endif *(int *)arg2 = NID_sha256; return 2;