Fix coverity CID #1458645 - Dereference before NULL check in rsa_digest_verify_final()

Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12628)
This commit is contained in:
Shane Lontis 2020-08-11 16:33:19 +10:00
parent fdf6118b15
commit 51bba73e93

View File

@ -775,10 +775,11 @@ static int rsa_digest_sign_final(void *vprsactx, unsigned char *sig,
unsigned char digest[EVP_MAX_MD_SIZE];
unsigned int dlen = 0;
prsactx->flag_allow_md = 1;
if (prsactx == NULL || prsactx->mdctx == NULL)
if (prsactx == NULL)
return 0;
prsactx->flag_allow_md = 1;
if (prsactx->mdctx == NULL)
return 0;
/*
* If sig is NULL then we're just finding out the sig size. Other fields
* are ignored. Defer to rsa_sign.