diff options
author | Rany Hany <rany_hany@riseup.net> | 2024-05-13 20:09:44 +0300 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2024-05-31 10:33:06 +0200 |
commit | a41747ac8e824b5cb9ed6874a688a4d5a578e10c (patch) | |
tree | e9869be9c0169856fa26982132e30eafeb3789f8 /package | |
parent | 50e26e6fd7a7447678f3d34c22fed82caf40aad4 (diff) | |
download | openwrt-a41747ac8e824b5cb9ed6874a688a4d5a578e10c.tar.gz openwrt-a41747ac8e824b5cb9ed6874a688a4d5a578e10c.tar.bz2 openwrt-a41747ac8e824b5cb9ed6874a688a4d5a578e10c.zip |
mbedtls: fix build on GCC 14
Without this patch, GCC 14 incorrectly complains about the following error:
In file included from /home/user/workspace/mbedtls/library/ctr_drbg.c:13:
In function ‘mbedtls_xor’,
inlined from ‘ctr_drbg_update_internal’ at /home/user/workspace/mbedtls/library/ctr_drbg.c:372:5:
/home/user/workspace/mbedtls/library/common.h:235:17: error: array subscript 48 is outside array bounds of ‘unsigned char[48]’ [-Werror=array-bounds=]
235 | r[i] = a[i] ^ b[i];
| ~^~~
/home/user/workspace/mbedtls/library/ctr_drbg.c: In function ‘ctr_drbg_update_internal’:
/home/user/workspace/mbedtls/library/ctr_drbg.c:335:19: note: at offset 48 into object ‘tmp’ of size 48
335 | unsigned char tmp[MBEDTLS_CTR_DRBG_SEEDLEN];
| ^~~
In function ‘mbedtls_xor’,
inlined from ‘ctr_drbg_update_internal’ at /home/user/workspace/mbedtls/library/ctr_drbg.c:372:5:
/home/user/workspace/mbedtls/library/common.h:235:24: error: array subscript 48 is outside array bounds of ‘const unsigned char[48]’ [-Werror=array-bounds=]
235 | r[i] = a[i] ^ b[i];
| ~^~~
/home/user/workspace/mbedtls/library/ctr_drbg.c: In function ‘ctr_drbg_update_internal’:
/home/user/workspace/mbedtls/library/ctr_drbg.c:333:57: note: at offset 48 into object ‘data’ of size [0, 48]
333 | const unsigned char data[MBEDTLS_CTR_DRBG_SEEDLEN])
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘mbedtls_xor’,
inlined from ‘ctr_drbg_update_internal’ at /home/user/workspace/mbedtls/library/ctr_drbg.c:372:5:
/home/user/workspace/mbedtls/library/common.h:235:14: error: array subscript 48 is outside array bounds of ‘unsigned char[48]’ [-Werror=array-bounds=]
235 | r[i] = a[i] ^ b[i];
| ~~~~~^~~~~~~~~~~~~
/home/user/workspace/mbedtls/library/ctr_drbg.c: In function ‘ctr_drbg_update_internal’:
/home/user/workspace/mbedtls/library/ctr_drbg.c:335:19: note: at offset 48 into object ‘tmp’ of size 48
335 | unsigned char tmp[MBEDTLS_CTR_DRBG_SEEDLEN];
| ^~~
This change adds a basic check to silence the warning until a solution is worked on upstream.
As this check is already used by another compiler, it shouldn't cause any issues for us.
Signed-off-by: Rany Hany <rany_hany@riseup.net>
Diffstat (limited to 'package')
-rw-r--r-- | package/libs/mbedtls/patches/100-fix-gcc14-build.patch | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/package/libs/mbedtls/patches/100-fix-gcc14-build.patch b/package/libs/mbedtls/patches/100-fix-gcc14-build.patch new file mode 100644 index 0000000000..656e605814 --- /dev/null +++ b/package/libs/mbedtls/patches/100-fix-gcc14-build.patch @@ -0,0 +1,11 @@ +--- a/library/common.h ++++ b/library/common.h +@@ -199,7 +199,7 @@ static inline void mbedtls_xor(unsigned + uint8x16_t x = veorq_u8(v1, v2); + vst1q_u8(r + i, x); + } +-#if defined(__IAR_SYSTEMS_ICC__) ++#if defined(__IAR_SYSTEMS_ICC__) || (defined(MBEDTLS_COMPILER_IS_GCC) && MBEDTLS_GCC_VERSION >= 140100) + /* This if statement helps some compilers (e.g., IAR) optimise out the byte-by-byte tail case + * where n is a constant multiple of 16. + * For other compilers (e.g. recent gcc and clang) it makes no difference if n is a compile-time |