Fix coverity CID #1458641 - Dereference before NULL check when setting ctx->flag_allow_md in rsa.c

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:50:10 +10:00
parent fa519461c9
commit db1319b706

View File

@ -725,7 +725,8 @@ static int rsa_digest_signverify_init(void *vprsactx, const char *mdname,
{
PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
prsactx->flag_allow_md = 0;
if (prsactx != NULL)
prsactx->flag_allow_md = 0;
if (!rsa_signature_init(vprsactx, vrsa, operation)
|| !rsa_setup_md(prsactx, mdname, NULL)) /* TODO RL */
return 0;
@ -811,8 +812,10 @@ int rsa_digest_verify_final(void *vprsactx, const unsigned char *sig,
unsigned char digest[EVP_MAX_MD_SIZE];
unsigned int dlen = 0;
if (prsactx == NULL)
return 0;
prsactx->flag_allow_md = 1;
if (prsactx == NULL || prsactx->mdctx == NULL)
if (prsactx->mdctx == NULL)
return 0;
/*