libmbedtls: fix compilation warning with GCC14

GCC 14.2 outputs the following compilation warning:

  CC out/arm-plat-imx/ta_arm64-lib/libmbedtls/mbedtls/library/ecp.o
  In file included from lib/libmbedtls/mbedtls/library/ctr_drbg.c:13:
  In function ‘mbedtls_xor’,
  inlined from ‘ctr_drbg_update_internal’ at lib/libmbedtls/mbedtls/library/ctr_drbg.c:372:5:
  lib/libmbedtls/mbedtls/library/common.h:245:17: warning: array subscript 48 is outside array bounds of ‘unsigned char[48]’ [-Warray-bounds=]
  245 | r[i] = a[i] ^ b[i];
  | ~^~~
  lib/libmbedtls/mbedtls/library/ctr_drbg.c: In function ‘ctr_drbg_update_internal’:
  lib/libmbedtls/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];
  | ^~~

Fix it by returning early in mbedtls_xor() if the compiler is GCC.
This fix is not in MBed TLS upstream yet but the issue and the fix have
been reported [1].

Link: https://github.com/Mbed-TLS/mbedtls/issues/9003#issuecomment-2108239255 [1]
Reported-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Closes: https://github.com/OP-TEE/optee_os/issues/7295
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Sahil Malhotra <sahil.malhotra@nxp.com>
1 file changed
tree: 50495061113166d723f10b95d6e31cf5a1a7ed78
  1. .devcontainer/
  2. .github/
  3. .vscode/
  4. core/
  5. keys/
  6. ldelf/
  7. lib/
  8. mk/
  9. scripts/
  10. ta/
  11. .checkpatch.conf
  12. .clang-format
  13. .gitattributes
  14. .gitignore
  15. CHANGELOG.md
  16. LICENSE
  17. MAINTAINERS
  18. Makefile
  19. README.md
  20. typedefs.checkpatch
README.md

OP-TEE Trusted OS

This git contains source code for the secure side implementation of OP-TEE project.

All official OP-TEE documentation has moved to http://optee.readthedocs.io.

// OP-TEE core maintainers