summaryrefslogtreecommitdiff
path: root/crypto/evp/ec_ctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/evp/ec_ctrl.c')
-rw-r--r--crypto/evp/ec_ctrl.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/ec_ctrl.c b/crypto/evp/ec_ctrl.c
index 404358ab97..ae4955287c 100644
--- a/crypto/evp/ec_ctrl.c
+++ b/crypto/evp/ec_ctrl.c
@@ -283,7 +283,9 @@ int EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **pukm)
*/
int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid)
{
- return EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_TYPE_GEN,
+ int keytype = nid == EVP_PKEY_SM2 ? EVP_PKEY_SM2 : EVP_PKEY_EC;
+
+ return EVP_PKEY_CTX_ctrl(ctx, keytype, EVP_PKEY_OP_TYPE_GEN,
EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID,
nid, NULL);
}