summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorBernd Edlinger <bernd.edlinger@hotmail.de>2024-02-08 22:44:33 +0100
committerTomas Mraz <tomas@openssl.org>2024-04-02 17:48:12 +0200
commite4308e7a98947c24e17a93de92147ee6815da581 (patch)
tree0f88732aaf1fdc69c3610dcc7675d78866d22325 /crypto
parentbe4717602dbd387ef4de6ab0a2311881fe31a67a (diff)
Remove handling of NULL sig param in ossl_ecdsa_deterministic_sign
The handling of sig=NULL was broken in this function, but since it is only used internally and was never called with sig=NULL, it is better to return an error in that case. Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/23529) (cherry picked from commit 294782f3b5c4b81d682e6e8608bb6e851177494d)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ec/ecdsa_ossl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/ec/ecdsa_ossl.c b/crypto/ec/ecdsa_ossl.c
index d7bd427e1b..e60877aa05 100644
--- a/crypto/ec/ecdsa_ossl.c
+++ b/crypto/ec/ecdsa_ossl.c
@@ -102,6 +102,11 @@ int ossl_ecdsa_deterministic_sign(const unsigned char *dgst, int dlen,
BIGNUM *kinv = NULL, *r = NULL;
int ret = 0;
+ if (sig == NULL) {
+ ERR_raise(ERR_LIB_EC, ERR_R_PASSED_NULL_PARAMETER);
+ return 0;
+ }
+
*siglen = 0;
if (!ecdsa_sign_setup(eckey, NULL, &kinv, &r, dgst, dlen,
nonce_type, digestname, libctx, propq))
@@ -111,7 +116,7 @@ int ossl_ecdsa_deterministic_sign(const unsigned char *dgst, int dlen,
if (s == NULL)
goto end;
- *siglen = i2d_ECDSA_SIG(s, sig != NULL ? &sig : NULL);
+ *siglen = i2d_ECDSA_SIG(s, &sig);
ECDSA_SIG_free(s);
ret = 1;
end: