mbedtls/include/mbedtls
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
..
aes.h Catch failures of AES or DES operations 2021-09-27 16:22:08 +02:00
aria.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
asn1.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
asn1write.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
base64.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
bignum.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
build_info.h New macro MBEDTLS_CHECK_RETURN 2021-09-27 16:22:08 +02:00
camellia.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
ccm.h Replace BAD_SEQUENCE error with BAD_INPUT 2021-09-01 13:26:44 +02:00
chacha20.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
chachapoly.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
check_config.h Merge pull request #4659 from spencer-burke/fixing_4222 2021-08-03 12:53:34 +02:00
cipher.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
cmac.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
compat-2.x.h Code review fixes 2021-06-18 12:59:38 +02:00
config_psa.h Fix typos pointed out by check_names 2021-08-10 11:26:15 +01:00
ctr_drbg.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
debug.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
des.h Catch failures of AES or DES operations 2021-09-27 16:22:08 +02:00
dhm.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
ecdh.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ecdsa.h Merge pull request #4694 from gilles-peskine-arm/out_size-3.0 2021-06-29 09:43:17 +02:00
ecjpake.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ecp.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
entropy.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
error.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
gcm.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
hkdf.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
hmac_drbg.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
mbedtls_config.h Merge pull request #1638 from dgreen-arm/check-names-rewrite 2021-09-27 12:28:53 +02:00
md.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
md5.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
memory_buffer_alloc.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
net_sockets.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
nist_kw.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
oid.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
pem.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
pk.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
pkcs5.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
pkcs12.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
platform.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
platform_time.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
platform_util.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
poly1305.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
private_access.h Introduce MBEDTLS_PRIVATE macro. 2021-05-21 18:07:06 +02:00
psa_util.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
ripemd160.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
rsa.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
sha1.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
sha256.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
sha512.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
ssl.h Add NamedGroup IANA values and helper functions 2021-09-08 09:52:15 +08:00
ssl_cache.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
ssl_ciphersuites.h Add TLS 1.3 ciphersuites 2021-08-12 06:28:45 +01:00
ssl_cookie.h Rename config.h to mbedtls_config.h 2021-06-28 09:28:33 +01:00
ssl_ticket.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
threading.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
timing.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
version.h Correct documentation references to Mbed TLS 2021-06-28 10:37:19 +01:00
x509.h Move MBEDTLS_ERR_xxx Doxygen comments before the definition 2021-08-02 22:51:03 +02:00
x509_crl.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
x509_crt.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00
x509_csr.h Replace all inclusions of config.h 2021-06-28 09:24:07 +01:00