mbedtls/tests
Gilles Peskine 377a310da4 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-29 20:40:31 +02:00
..
.jenkins Add a Jenkinsfile for PR job testing 2018-10-19 16:41:54 +01:00
configs Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
data_files More precise testing of dhm_min_len 2021-04-01 14:18:31 +02:00
docker/bionic Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
git-scripts Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
include Merge pull request #4605 from gabor-mezei-arm/3267_sign_verify_key_policies 2021-06-30 14:51:03 +01:00
scripts Fix mixup about the directory containing the success indicator file 2021-07-22 19:45:12 +02:00
src Merge pull request #4182 from gabor-mezei-arm/3258_implement_one-shot_MAC_and_cipher 2021-06-30 17:04:11 +01:00
suites Catch failures of AES or DES operations 2021-09-29 20:40:31 +02:00
.gitignore Apply feedback from PR review 2020-09-07 14:01:52 +02:00
CMakeLists.txt Add missing test suites to CMakeLists.txt 2021-05-25 19:35:17 +02:00
compat-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
compat.sh Fix SSL tests scripts with recent OpenSSL server with Diffie-Hellman 2021-04-01 14:06:41 +02:00
context-info.sh Merge pull request #3614 from gilles-peskine-arm/ssl-opt-gnutls-printf-development 2020-11-04 17:55:42 +01:00
Descriptions.txt Revert "Remove tests that depend on TLS or X.509" 2020-03-19 14:17:54 +01:00
make-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
Makefile Use python3 when building on non-Windows for Windows 2021-07-21 19:27:50 +02:00
ssl-opt-in-docker.sh Update copyright notices to use Linux Foundation guidance 2020-08-19 10:35:41 +02:00
ssl-opt.sh Merge pull request #4696 from yutotakano/fix-ssl-opt.sh-hard-abort-2.x 2021-08-04 10:16:42 +02:00