mirror of https://github.com/openssl/openssl
signature/rsa_sig.c: Add checks for the EVP_MD_get_size()
Add checks for the EVP_MD_get_size() to avoid integer overflow and then explicitly cast from int to size_t.
Fixes: 6f4b766315
("PROV: add RSA signature implementation")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23949)
This commit is contained in:
parent
7638f4016a
commit
6c0f154750
|
@ -114,8 +114,14 @@ typedef struct {
|
|||
|
||||
static size_t rsa_get_md_size(const PROV_RSA_CTX *prsactx)
|
||||
{
|
||||
if (prsactx->md != NULL)
|
||||
return EVP_MD_get_size(prsactx->md);
|
||||
int md_size;
|
||||
|
||||
if (prsactx->md != NULL) {
|
||||
md_size = EVP_MD_get_size(prsactx->md);
|
||||
if (md_size <= 0)
|
||||
return 0;
|
||||
return md_size;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue