Skip to content

Commit

Permalink
Fix sm2 init failure.
Browse files Browse the repository at this point in the history
Babassl ticket:
#589
  • Loading branch information
naghaabirami committed Mar 18, 2024
1 parent 0d997f9 commit ea1e4bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto/evp/ec_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ 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);
}
Expand Down

0 comments on commit ea1e4bd

Please sign in to comment.