summaryrefslogtreecommitdiffstats
path: root/crypto/sm2/sm2_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/sm2/sm2_sign.c')
-rw-r--r--crypto/sm2/sm2_sign.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c
index ca76128a24..1b3ca94d6e 100644
--- a/crypto/sm2/sm2_sign.c
+++ b/crypto/sm2/sm2_sign.c
@@ -450,6 +450,11 @@ int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen,
int sigleni;
int ret = -1;
+ if (sig == NULL) {
+ ERR_raise(ERR_LIB_SM2, ERR_R_PASSED_NULL_PARAMETER);
+ goto done;
+ }
+
e = BN_bin2bn(dgst, dgstlen, NULL);
if (e == NULL) {
ERR_raise(ERR_LIB_SM2, ERR_R_BN_LIB);
@@ -462,7 +467,7 @@ int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen,
goto done;
}
- sigleni = i2d_ECDSA_SIG(s, sig != NULL ? &sig : NULL);
+ sigleni = i2d_ECDSA_SIG(s, &sig);
if (sigleni < 0) {
ERR_raise(ERR_LIB_SM2, ERR_R_INTERNAL_ERROR);
goto done;