mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-31 10:20:45 +00:00
Add comment to non-obvious code guard
Ad and body lengths can only be too big on builds where size_t is bigger than 32 bits. This checking code therefore generates always true comparison warnings on 32 bit platforms, and thus had to be guarded. Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
6edb7473db
commit
ef29e17a94
@ -447,6 +447,9 @@ psa_status_t mbedtls_psa_aead_set_lengths( mbedtls_psa_aead_operation_t
|
|||||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM)
|
#if defined(MBEDTLS_PSA_BUILTIN_ALG_GCM)
|
||||||
if( operation->alg == PSA_ALG_GCM )
|
if( operation->alg == PSA_ALG_GCM )
|
||||||
{
|
{
|
||||||
|
/* Lengths can only be too large for GCM if size_t is bigger than 32
|
||||||
|
* bits. Without the guard this code will generate warnings on 32bit
|
||||||
|
builds */
|
||||||
#if SIZE_MAX > UINT32_MAX
|
#if SIZE_MAX > UINT32_MAX
|
||||||
if( ( (uint64_t) ad_length ) >> 61 != 0 ||
|
if( ( (uint64_t) ad_length ) >> 61 != 0 ||
|
||||||
( (uint64_t) plaintext_length ) > 0xFFFFFFFE0ull )
|
( (uint64_t) plaintext_length ) > 0xFFFFFFFE0ull )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user