
From: lizhi <lizhi206@huawei.com> Fixed a bug where, under scenarios with insufficient contexts, the signature verification, encryption, and decryption processes failed to switch openssl soft computation. Signed-off-by: lizhi <lizhi206@huawei.com> Signed-off-by: JiangShui Yang <yangjiangshui@h-partners.com> --- src/uadk_prov_sm2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uadk_prov_sm2.c b/src/uadk_prov_sm2.c index b748414..6ae70c6 100644 --- a/src/uadk_prov_sm2.c +++ b/src/uadk_prov_sm2.c @@ -1534,7 +1534,7 @@ static int uadk_signature_sm2_verify(void *vpsm2ctx, const unsigned char *sig, s ret = uadk_prov_sm2_check_tbs_params(psm2ctx, tbs, tbslen); if (ret == UADK_P_FAIL) { fprintf(stderr, "failed to check sm2 verify params\n"); - return ret; + goto do_soft; } ret = uadk_prov_sm2_verify(psm2ctx, sig, siglen, tbs, tbslen); @@ -2827,7 +2827,7 @@ static int uadk_asym_cipher_sm2_encrypt(void *vpsm2ctx, unsigned char *out, size ret = uadk_prov_sm2_encrypt_check(psm2ctx, out, outlen, in, inlen); if (ret == UADK_P_FAIL) - return ret; + return uadk_prov_sm2_encrypt_sw(vpsm2ctx, out, outlen, in, inlen); /* If out is NULL, compute outlen size and return */ if (out == NULL) { @@ -3074,7 +3074,7 @@ static int uadk_asym_cipher_sm2_decrypt(void *vpsm2ctx, unsigned char *out, size smctx = psm2ctx->sm2_pctx; ret = uadk_prov_sm2_decrypt_check(smctx, out, outlen, in, inlen); if (ret == UADK_P_FAIL) - return ret; + return uadk_prov_sm2_decrypt_sw(vpsm2ctx, out, outlen, in, inlen); if (out == NULL) { if (!uadk_prov_sm2_plaintext_size(in, inlen, outlen)) -- 2.33.0