From 5c7ab6fe865e96e42728aea2133da84013cae277 Mon Sep 17 00:00:00 2001 From: BrianX7c <151365853+BrianX7c@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:07:37 +0100 Subject: [PATCH] [cipher.h] Arithmetic overflow in binary left shift operation (MBEDTLS_KEY_BITLEN_SHIFT) Fixing arithmetic overflow warning (C6297), if compiled in Visual Studio Signed-off-by: BrianX7c <151365853+BrianX7c@users.noreply.github.com> --- include/mbedtls/cipher.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h index 2596baa92..815b5bb19 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -480,7 +480,7 @@ static inline size_t mbedtls_cipher_info_get_key_bitlen( if (info == NULL) { return 0; } else { - return info->MBEDTLS_PRIVATE(key_bitlen) << MBEDTLS_KEY_BITLEN_SHIFT; + return ((size_t) info->MBEDTLS_PRIVATE(key_bitlen)) << MBEDTLS_KEY_BITLEN_SHIFT; } }