ssl_cipher_get_overhead(): Replace size_t with int and add the checks
authorJiasheng Jiang <jiasheng@purdue.edu>
Fri, 22 Mar 2024 15:15:09 +0000 (15:15 +0000)
committerTomas Mraz <tomas@openssl.org>
Fri, 10 May 2024 09:35:22 +0000 (11:35 +0200)
commit4a5088259e78127354f497931568de409ac905fc
treec5c1a8bb5d8edc5f3eda7785a41d829ebee4ec39
parentd3184110196b690d314424ac55404278d98eda32
ssl_cipher_get_overhead(): Replace size_t with int and add the checks

Replace the type of "mac", "out", and "blk" with int to avoid implicit
conversion when it is assigned by EVP_MD_get_size(),
EVP_CIPHER_get_iv_length(), and EVP_CIPHER_get_block_size().
Moreover, add the checks to avoid integer overflow.

Fixes: 045bd04706 ("Add DTLS_get_data_mtu() function")
Signed-off-by: Jiasheng Jiang <jiasheng@purdue.edu>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23935)
ssl/ssl_ciph.c