mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
The combination of the multi-byte loop with the single byte loop confuses GCC 14.3's array bounds checker. When the loop size is constant, check to see if it is a multiple of the multi-byte size and bail early. As this will be evaluated at compile time, there should be no run-time cost. This change uses the __builtin_constant_p compile-time operation. To check if that is supported, the change uses the existing MBEDTLS_HAS_BUILTIN macro. That macro was defined later in library/common.h than is needed for this change, so it was moved up to join some other macros that looked similar. Signed-off-by: Keith Packard <keithp@keithp.com>
5 lines
247 B
Plaintext
5 lines
247 B
Plaintext
Bugfix
|
|
* Appease GCC 14.3's array bounds checker by inserting checks in mbedtls_xor
|
|
that bail before the byte-at-a-time loop when the array size is a constant
|
|
(using MBEDTLS_HAS_BUILTIN) and an exact multiple of the larger loop size.
|