mbedtls/tests/suites
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
..
helpers.function
host_test.function Fix build error when int32_t is not int 2021-05-18 16:43:00 +02:00
main_test.function
target_test.function
test_suite_aes.cbc.data
test_suite_aes.cfb.data
test_suite_aes.ecb.data
test_suite_aes.function Catch failures of AES or DES operations 2021-09-29 20:40:31 +02:00
test_suite_aes.ofb.data
test_suite_aes.rest.data
test_suite_aes.xts.data
test_suite_arc4.data
test_suite_arc4.function
test_suite_aria.data
test_suite_aria.function
test_suite_asn1parse.data
test_suite_asn1parse.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_asn1write.data
test_suite_asn1write.function
test_suite_base64.data
test_suite_base64.function
test_suite_blowfish.data
test_suite_blowfish.function
test_suite_camellia.data
test_suite_camellia.function
test_suite_ccm.data
test_suite_ccm.function
test_suite_chacha20.data
test_suite_chacha20.function
test_suite_chachapoly.data
test_suite_chachapoly.function
test_suite_cipher.aes.data
test_suite_cipher.arc4.data
test_suite_cipher.aria.data
test_suite_cipher.blowfish.data
test_suite_cipher.camellia.data
test_suite_cipher.ccm.data
test_suite_cipher.chacha20.data
test_suite_cipher.chachapoly.data
test_suite_cipher.des.data
test_suite_cipher.function
test_suite_cipher.gcm.data
test_suite_cipher.misc.data
test_suite_cipher.nist_kw.data
test_suite_cipher.null.data
test_suite_cipher.padding.data
test_suite_cmac.data
test_suite_cmac.function
test_suite_ctr_drbg.data
test_suite_ctr_drbg.function
test_suite_debug.data Add mbedtls_debug_print_mpi test case for 0 2021-06-07 21:41:53 +02:00
test_suite_debug.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_des.data
test_suite_des.function Catch failures of AES or DES operations 2021-09-29 20:40:31 +02:00
test_suite_dhm.data Unify G=1 and G=-1 test cases 2021-06-22 12:39:17 +02:00
test_suite_dhm.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_ecdh.data
test_suite_ecdh.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_ecdsa.data
test_suite_ecdsa.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_ecjpake.data
test_suite_ecjpake.function
test_suite_ecp.data Fix ecp_check_pub() test cases 2021-06-25 14:59:15 +01:00
test_suite_ecp.function Merge remote-tracking branch 'restricted/development_2.x-restricted' into mbedtls-2.27.0rc0-pr 2021-07-01 17:26:38 +01:00
test_suite_entropy.data
test_suite_entropy.function
test_suite_error.data
test_suite_error.function
test_suite_gcm.aes128_de.data
test_suite_gcm.aes128_en.data
test_suite_gcm.aes192_de.data
test_suite_gcm.aes192_en.data
test_suite_gcm.aes256_de.data
test_suite_gcm.aes256_en.data
test_suite_gcm.camellia.data
test_suite_gcm.function
test_suite_gcm.misc.data
test_suite_hkdf.data
test_suite_hkdf.function
test_suite_hmac_drbg.function
test_suite_hmac_drbg.misc.data
test_suite_hmac_drbg.no_reseed.data
test_suite_hmac_drbg.nopr.data
test_suite_hmac_drbg.pr.data
test_suite_md.data
test_suite_md.function
test_suite_mdx.data
test_suite_mdx.function
test_suite_memory_buffer_alloc.data
test_suite_memory_buffer_alloc.function
test_suite_mpi.data Fix copypasta in test data 2021-06-22 12:39:17 +02:00
test_suite_mpi.function Fix copypasta in test function argument name 2021-06-22 12:39:17 +02:00
test_suite_mps.data
test_suite_mps.function
test_suite_net.data
test_suite_net.function
test_suite_nist_kw.data
test_suite_nist_kw.function
test_suite_oid.data
test_suite_oid.function
test_suite_pem.data
test_suite_pem.function
test_suite_pk.data
test_suite_pk.function test_suite_pk.function: Do not use MD_MAX_SIZE 2021-06-29 09:31:06 -04:00
test_suite_pkcs1_v15.data
test_suite_pkcs1_v15.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_pkcs1_v21.data
test_suite_pkcs1_v21.function Make the fallback behavior of mbedtls_test_rnd_buffer_rand optional 2021-06-02 21:31:24 +02:00
test_suite_pkcs5.data
test_suite_pkcs5.function
test_suite_pkparse.data Remove spurious dependencies on PEM 2021-05-31 20:26:12 +02:00
test_suite_pkparse.function
test_suite_pkwrite.data
test_suite_pkwrite.function
test_suite_poly1305.data
test_suite_poly1305.function
test_suite_psa_crypto_attributes.data
test_suite_psa_crypto_attributes.function
test_suite_psa_crypto_driver_wrappers.data Unify multipart cipher operation tester functions 2021-06-25 18:30:38 +02:00
test_suite_psa_crypto_driver_wrappers.function Unify multipart cipher operation tester functions 2021-06-25 18:30:38 +02:00
test_suite_psa_crypto_entropy.data
test_suite_psa_crypto_entropy.function Remove some remaining uses of deprecated constants 2021-05-17 22:31:15 +02:00
test_suite_psa_crypto_hash.data
test_suite_psa_crypto_hash.function
test_suite_psa_crypto_init.data
test_suite_psa_crypto_init.function
test_suite_psa_crypto_metadata.data New macro PSA_KEY_LIFETIME_IS_READ_ONLY 2021-05-27 21:10:09 +02:00
test_suite_psa_crypto_metadata.function Remove trailing whitespace 2021-07-15 09:02:43 +01:00
test_suite_psa_crypto_not_supported.function
test_suite_psa_crypto_not_supported.generated.data
test_suite_psa_crypto_not_supported.misc.data
test_suite_psa_crypto_persistent_key.data Add negative tests for psa_destroy_key 2021-05-28 12:53:15 +02:00
test_suite_psa_crypto_persistent_key.function Add negative tests for psa_destroy_key 2021-05-28 12:53:15 +02:00
test_suite_psa_crypto_se_driver_hal_mocks.data
test_suite_psa_crypto_se_driver_hal_mocks.function
test_suite_psa_crypto_se_driver_hal.data
test_suite_psa_crypto_se_driver_hal.function
test_suite_psa_crypto_slot_management.data Make immediate constants unsigned 2021-05-28 12:53:15 +02:00
test_suite_psa_crypto_slot_management.function Rename function to conform to the library 2021-06-28 15:37:36 +02:00
test_suite_psa_crypto_storage_format.current.data Update tests for extended key usage policies 2021-06-24 11:58:19 +02:00
test_suite_psa_crypto_storage_format.function Check that attempting to destroy a read-only key fails 2021-05-28 12:53:15 +02:00
test_suite_psa_crypto_storage_format.misc.data Remove obsolete MBEDTLS_xxx dependencies 2021-07-21 19:26:50 +02:00
test_suite_psa_crypto_storage_format.v0.data Refactor key generation 2021-06-28 21:36:58 +02:00
test_suite_psa_crypto.data Add non regression test for cipher output size 2021-07-23 18:58:19 +01:00
test_suite_psa_crypto.function Add non regression test for cipher output size 2021-07-23 18:58:19 +01:00
test_suite_psa_its.data
test_suite_psa_its.function
test_suite_random.data
test_suite_random.function
test_suite_rsa.data Add RSA tests with message=0 2021-06-22 12:39:17 +02:00
test_suite_rsa.function Add RSA tests with message=0 2021-06-22 12:39:17 +02:00
test_suite_shax.data
test_suite_shax.function
test_suite_ssl.data tests: Fix test arguments separator 2021-05-05 09:02:13 +02:00
test_suite_ssl.function avoid -Wmaybe-uninitialized when buiding with gcc11 2021-05-13 10:26:52 -04:00
test_suite_timing.data
test_suite_timing.function
test_suite_version.data Bump Library Version Number 2021-07-01 17:52:07 +01:00
test_suite_version.function
test_suite_x509parse.data
test_suite_x509parse.function
test_suite_x509write.data
test_suite_x509write.function Use mbedtls_test_read_mpi in test suites 2021-06-22 12:39:17 +02:00
test_suite_xtea.data
test_suite_xtea.function