summaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsa_sign.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dsa/dsa_sign.c')
-rw-r--r--crypto/dsa/dsa_sign.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/dsa/dsa_sign.c b/crypto/dsa/dsa_sign.c
index b806e7e655..190aca8ad9 100644
--- a/crypto/dsa/dsa_sign.c
+++ b/crypto/dsa/dsa_sign.c
@@ -157,6 +157,11 @@ int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen,
{
DSA_SIG *s;
+ if (sig == NULL) {
+ *siglen = DSA_size(dsa);
+ return 1;
+ }
+
/* legacy case uses the method table */
if (dsa->libctx == NULL || dsa->meth != DSA_get_default_method())
s = DSA_do_sign(dgst, dlen, dsa);
@@ -167,7 +172,7 @@ int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen,
*siglen = 0;
return 0;
}
- *siglen = i2d_DSA_SIG(s, sig != NULL ? &sig : NULL);
+ *siglen = i2d_DSA_SIG(s, &sig);
DSA_SIG_free(s);
return 1;
}