aboutsummaryrefslogtreecommitdiff
path: root/crypto/sm2/sm2_sign.c
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2025-08-08 19:24:09 +0000
committerEnji Cooper <ngie@FreeBSD.org>2025-08-08 19:33:57 +0000
commitfbc35f82f0eca4571df0d753da74571e01ace763 (patch)
treeb1140e447e6c40c2bc65e7fc3413664fe98c3666 /crypto/sm2/sm2_sign.c
parent1095efe41feed8ea5a6fe5ca123c347ae0914801 (diff)
Diffstat (limited to 'crypto/sm2/sm2_sign.c')
-rw-r--r--crypto/sm2/sm2_sign.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c
index 28cf95cc48c9..7c49128b47db 100644
--- a/crypto/sm2/sm2_sign.c
+++ b/crypto/sm2/sm2_sign.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2017-2024 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2025 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2017 Ribose Inc. All Rights Reserved.
* Ported from Ribose contributions from Botan.
*
@@ -220,6 +220,10 @@ static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e)
BIGNUM *tmp = NULL;
OSSL_LIB_CTX *libctx = ossl_ec_key_get_libctx(key);
+ if (dA == NULL) {
+ ERR_raise(ERR_LIB_SM2, SM2_R_INVALID_PRIVATE_KEY);
+ goto done;
+ }
kG = EC_POINT_new(group);
if (kG == NULL) {
ERR_raise(ERR_LIB_SM2, ERR_R_EC_LIB);