summaryrefslogtreecommitdiffstats
path: root/crypto/sm2
diff options
context:
space:
mode:
authorPaul Yang <kaishen.yy@antfin.com>2020-09-13 14:31:13 +0200
committerMatt Caswell <matt@openssl.org>2020-09-22 09:18:09 +0200
commitb3d267caac21dd0a7d7a8cfcc304b253df5e82f4 (patch)
tree564617e6678615586334c8fdaecc794f06282364 /crypto/sm2
parentAdd SM2 signature algorithm to default provider (diff)
downloadopenssl-b3d267caac21dd0a7d7a8cfcc304b253df5e82f4.tar.xz
openssl-b3d267caac21dd0a7d7a8cfcc304b253df5e82f4.zip
Address review comments
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12536)
Diffstat (limited to 'crypto/sm2')
-rw-r--r--crypto/sm2/sm2_sign.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c
index 9216ab6b3d..39b6e11cf2 100644
--- a/crypto/sm2/sm2_sign.c
+++ b/crypto/sm2/sm2_sign.c
@@ -428,19 +428,19 @@ int sm2_internal_sign(const unsigned char *dgst, int dgstlen,
e = BN_bin2bn(dgst, dgstlen, NULL);
if (e == NULL) {
- SM2err(SM2_F_SM2_INTERNAL_SIGN, ERR_R_BN_LIB);
+ SM2err(0, ERR_R_BN_LIB);
goto done;
}
s = sm2_sig_gen(eckey, e);
if (s == NULL) {
- SM2err(SM2_F_SM2_INTERNAL_SIGN, ERR_R_INTERNAL_ERROR);
+ SM2err(0, ERR_R_INTERNAL_ERROR);
goto done;
}
sigleni = i2d_ECDSA_SIG(s, &sig);
if (sigleni < 0) {
- SM2err(SM2_F_SM2_INTERNAL_SIGN, ERR_R_INTERNAL_ERROR);
+ SM2err(0, ERR_R_INTERNAL_ERROR);
goto done;
}
*siglen = (unsigned int)sigleni;
@@ -465,23 +465,23 @@ int sm2_internal_verify(const unsigned char *dgst, int dgstlen,
s = ECDSA_SIG_new();
if (s == NULL) {
- SM2err(SM2_F_SM2_INTERNAL_VERIFY, ERR_R_MALLOC_FAILURE);
+ SM2err(0, ERR_R_MALLOC_FAILURE);
goto done;
}
if (d2i_ECDSA_SIG(&s, &p, sig_len) == NULL) {
- SM2err(SM2_F_SM2_INTERNAL_VERIFY, SM2_R_INVALID_ENCODING);
+ SM2err(0, SM2_R_INVALID_ENCODING);
goto done;
}
/* Ensure signature uses DER and doesn't have trailing garbage */
derlen = i2d_ECDSA_SIG(s, &der);
if (derlen != sig_len || memcmp(sig, der, derlen) != 0) {
- SM2err(SM2_F_SM2_INTERNAL_VERIFY, SM2_R_INVALID_ENCODING);
+ SM2err(0, SM2_R_INVALID_ENCODING);
goto done;
}
e = BN_bin2bn(dgst, dgstlen, NULL);
if (e == NULL) {
- SM2err(SM2_F_SM2_INTERNAL_VERIFY, ERR_R_BN_LIB);
+ SM2err(0, ERR_R_BN_LIB);
goto done;
}