mbedtls/tests
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
..
.jenkins
configs Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
data_files Removal of RC4 certs and fixes to docs and tests 2021-06-21 13:27:29 +02:00
docker/bionic Upgrade gnutls-next to 3.7.2 2021-09-02 17:31:10 +08:00
git-scripts Update scripts to use check-names.py 2021-08-06 21:04:32 +01:00
include Styling and refactoring 2021-09-10 07:16:08 +05:30
scripts Merge pull request #1638 from dgreen-arm/check-names-rewrite 2021-09-27 12:28:53 +02:00
src Styling and refactoring 2021-09-10 07:16:08 +05:30
suites Catch failures of AES or DES operations 2021-09-27 16:22:08 +02:00
.gitignore Ignore generated source files that are no longer checked in 2021-05-20 10:37:22 +02:00
CMakeLists.txt Remove MD2, MD4, RC4, Blowfish and XTEA 2021-06-16 10:34:25 +02:00
compat-in-docker.sh Upgrade gnutls-next to 3.7.2 2021-09-02 17:31:10 +08:00
compat.sh Improve comments to be more accurate 2021-09-03 13:19:57 +01:00
context-info.sh Modifies tests in context-info.sh 2021-06-16 16:19:53 +01:00
Descriptions.txt
make-in-docker.sh
Makefile Error out if enumerating the generated data files fails 2021-07-13 18:36:05 +02:00
ssl-opt-in-docker.sh Upgrade gnutls-next to 3.7.2 2021-09-02 17:31:10 +08:00
ssl-opt.sh Add gnutls version test for client hello 2021-09-22 21:16:27 +08:00