mbedtls/programs/test
Gilles Peskine 7820a574f1 Catch failures of AES or DES operations
Declare all AES and DES functions that return int as needing to have
their result checked, and do check the result in our code.

A DES or AES block operation can fail in alternative implementations of
mbedtls_internal_aes_encrypt() (under MBEDTLS_AES_ENCRYPT_ALT),
mbedtls_internal_aes_decrypt() (under MBEDTLS_AES_DECRYPT_ALT),
mbedtls_des_crypt_ecb() (under MBEDTLS_DES_CRYPT_ECB_ALT),
mbedtls_des3_crypt_ecb() (under MBEDTLS_DES3_CRYPT_ECB_ALT).
A failure can happen if the accelerator peripheral is in a bad state.
Several block modes were not catching the error.

This commit does the following code changes, grouped together to avoid
having an intermediate commit where the build fails:

* Add MBEDTLS_CHECK_RETURN to all functions returning int in aes.h and des.h.
* Fix all places where this causes a GCC warning, indicating that our code
  was not properly checking the result of an AES operation:
    * In library code: on failure, goto exit and return ret.
    * In pkey programs: goto exit.
    * In the benchmark program: exit (not ideal since there's no error
      message, but it's what the code currently does for failures).
    * In test code: TEST_ASSERT.
* Changelog entry.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-09-27 16:22:08 +02:00
..
cmake_package Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
cmake_package_install Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
cmake_subproject Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
benchmark.c Catch failures of AES or DES operations 2021-09-27 16:22:08 +02:00
CMakeLists.txt Generate cpp_cummy_build.cpp dynamically 2021-07-12 18:19:31 +02:00
generate_cpp_dummy_build.sh Add documentation 2021-08-05 15:23:00 +02:00
query_compile_time_config.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
query_config.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
selftest.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
udp_proxy.c Fix bug with UDP proxy not forwarding enough 2021-07-06 12:39:43 +02:00
udp_proxy_wrapper.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
zeroize.c Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00