Skip to content

Commit

Permalink
EVP_DigestSignFinal: *siglen should not be read if sigret == NULL
Browse files Browse the repository at this point in the history
This fixes small regression from #16962.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #17460)

(cherry picked from commit a4e0118)
  • Loading branch information
t8m committed Jan 12, 2022
1 parent 3755dc2 commit 3dcec2f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crypto/evp/m_sigver.c
Expand Up @@ -480,14 +480,14 @@ int EVP_DigestSignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
if (sigret == NULL || (ctx->flags & EVP_MD_CTX_FLAG_FINALISE) != 0)
return pctx->op.sig.signature->digest_sign_final(pctx->op.sig.algctx,
sigret, siglen,
(siglen == NULL) ? 0 : *siglen);
sigret == NULL ? 0 : *siglen);
dctx = EVP_PKEY_CTX_dup(pctx);
if (dctx == NULL)
return 0;

r = dctx->op.sig.signature->digest_sign_final(dctx->op.sig.algctx,
sigret, siglen,
(siglen == NULL) ? 0 : *siglen);
*siglen);
EVP_PKEY_CTX_free(dctx);
return r;

Expand Down

0 comments on commit 3dcec2f

Please sign in to comment.