Skip to content

Commit

Permalink
If oaep_md is not initialized, correctly initialize it
Browse files Browse the repository at this point in the history
Fixes #20993

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20994)

(cherry picked from commit c5aa719)
  • Loading branch information
beldmit authored and t8m committed May 23, 2023
1 parent 3ea88ee commit d411105
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions providers/implementations/asymciphers/rsa_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ static int rsa_encrypt(void *vprsactx, unsigned char *out, size_t *outlen,
return 0;
}
if (prsactx->oaep_md == NULL) {
OPENSSL_free(tbuf);
prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL);
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
return 0;
if (prsactx->oaep_md == NULL) {
OPENSSL_free(tbuf);
ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
return 0;
}
}
ret =
ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(prsactx->libctx, tbuf,
Expand Down

0 comments on commit d411105

Please sign in to comment.