X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fec%2Fec_ameth.c;h=602ff7c557e2f9361b94246fdf7f366d9ca6fa3b;hp=6105e6b0874654424f44f2b27a61df67bd56c786;hb=cd701de96a147260c2290d85af8a0656120a8ff8;hpb=12a765a5235f181c2f4992b615eb5f892c368e88 diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c index 6105e6b087..602ff7c557 100644 --- a/crypto/ec/ec_ameth.c +++ b/crypto/ec/ec_ameth.c @@ -7,6 +7,12 @@ * https://www.openssl.org/source/license.html */ +/* + * ECDH and ECDSA low level APIs are deprecated for public use, but still ok + * for internal use. + */ +#include "internal/deprecated.h" + #include #include "internal/cryptlib.h" #include @@ -23,7 +29,7 @@ static int ecdh_cms_decrypt(CMS_RecipientInfo *ri); static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); #endif -static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key) +static int eckey_param2type(int *pptype, void **ppval, const EC_KEY *ec_key) { const EC_GROUP *group; int nid; @@ -57,7 +63,7 @@ static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key) static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) { - EC_KEY *ec_key = pkey->pkey.ec; + const EC_KEY *ec_key = pkey->pkey.ec; void *pval = NULL; int ptype; unsigned char *penc = NULL, *p; @@ -507,9 +513,9 @@ static int ec_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) if (EVP_PKEY_id(pkey) == EVP_PKEY_SM2) { /* For SM2, the only valid digest-alg is SM3 */ *(int *)arg2 = NID_sm3; - } else { - *(int *)arg2 = NID_sha256; + return 2; /* Make it mandatory */ } + *(int *)arg2 = NID_sha256; return 1; case ASN1_PKEY_CTRL_SET1_TLS_ENCPT: