mbedtls/tests/suites
Gilles Peskine e8d7e6c6e4 More robust code to set the IV
Check that the source address and the frame counter have the expected
length. Otherwise, if the test data was invalid, the test code could
build nonsensical inputs, potentially overflowing the iv buffer.

The primary benefit of this change is that it also silences a warning
from compiling with `gcc-10 -O3` (observed with GCC 10.2.0 on
Linux/amd64). GCC unrolled the loops and complained about a buffer
overflow with warnings like:
```
suites/test_suite_ccm.function: In function 'test_mbedtls_ccm_star_auth_decrypt':
suites/test_suite_ccm.function:271:15: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  271 |         iv[i] = source_address->x[i];
      |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
suites/test_suite_ccm.function:254:19: note: at offset [13, 14] to object 'iv' with size 13 declared here
  254 |     unsigned char iv[13];
```
Just using memcpy instead of loops bypasses this warnings. The added
checks are a bonus.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2021-02-17 18:08:06 +01:00
..
helpers.function Merge pull request #3529 from ronald-cron-arm/common-mbedtls_param_failed-2.16 2020-10-06 22:15:47 +02:00
host_test.function Fix GCC warning about test_snprintf 2020-11-28 14:04:49 -03:00
main_test.function Merge pull request #3602 from gufe44/arc4random_buf-implicit-2.16 2020-11-12 12:12:45 +01:00
target_test.function tests: Add mbedtls_test_ prefix to *hexify functions 2020-06-26 09:15:43 +02:00
test_suite_aes.cbc.data
test_suite_aes.cfb.data
test_suite_aes.ecb.data
test_suite_aes.function tests: Remove usage of mbedtls_test_hexify for comparison 2020-07-30 16:01:41 +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 tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_aria.data
test_suite_aria.function tests: Replace "TEST_ASSERT(!memcmp ...)" by ASSERT_COMPARE 2020-07-30 16:08:50 +02:00
test_suite_asn1write.data
test_suite_asn1write.function Typo fix in test_suite_asn1write.function 2020-03-25 07:48:11 -04:00
test_suite_base64.data
test_suite_base64.function
test_suite_blowfish.data
test_suite_blowfish.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_camellia.data
test_suite_camellia.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_ccm.data Fix #2370, minor typos and spelling mistakes 2019-02-18 14:50:57 +00:00
test_suite_ccm.function More robust code to set the IV 2021-02-17 18:08:06 +01:00
test_suite_chacha20.data
test_suite_chacha20.function tests: Replace "TEST_ASSERT(!memcmp ...)" by ASSERT_COMPARE 2020-07-30 16:08:50 +02:00
test_suite_chachapoly.data
test_suite_chachapoly.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_cipher.aes.data test: Check empty buffer decryption for chachapoly 2019-06-06 12:04:13 +01:00
test_suite_cipher.arc4.data
test_suite_cipher.blowfish.data
test_suite_cipher.camellia.data
test_suite_cipher.ccm.data
test_suite_cipher.chacha20.data test: Remove redundant 0-byte decryption test 2019-06-06 12:04:13 +01:00
test_suite_cipher.chachapoly.data test: Check empty buffer decryption for chachapoly 2019-06-06 12:04:13 +01:00
test_suite_cipher.des.data
test_suite_cipher.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_cipher.gcm.data Add missing dependencies in test_suite_cipher.gcm 2019-01-02 10:48:25 +00:00
test_suite_cipher.misc.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 Support set *_drbg reseed interval before seed 2020-12-03 13:30:36 -08:00
test_suite_debug.data Update certificates to expire in 2029 2019-07-10 18:35:10 +03:00
test_suite_debug.function
test_suite_des.data
test_suite_des.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_dhm.data Test that overly large Diffie-Hellman keys are rejected 2020-12-03 16:07:49 +00:00
test_suite_dhm.function Fix test_suite_dhm build 2020-12-03 17:55:59 +00:00
test_suite_ecdh.data Add test case for ecdh_get_params with mismatching group 2019-02-22 10:24:31 +01:00
test_suite_ecdh.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_ecdsa.data
test_suite_ecdsa.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_ecjpake.data Add a test for mlaformed ECJPAKE context 2019-07-08 15:44:37 +02:00
test_suite_ecjpake.function Add a test for mlaformed ECJPAKE context 2019-07-08 15:44:37 +02:00
test_suite_ecp.data Add test cases to check rng failure 2020-05-25 13:55:09 +02:00
test_suite_ecp.function tests: Add mbedtls_test_ prefix to hexcmp() 2020-07-30 15:41:32 +02:00
test_suite_entropy.data
test_suite_entropy.function Fix build failure with MBEDTLS_PLATFORM_NV_SEED_ALT 2020-04-28 15:02:50 +02:00
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 tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_gcm.misc.data
test_suite_hkdf.data
test_suite_hkdf.function tests: Replace "TEST_ASSERT(!memcmp ...)" by ASSERT_COMPARE 2020-07-30 16:08:50 +02:00
test_suite_hmac_drbg.function Support set *_drbg reseed interval before seed 2020-12-03 13:30:36 -08:00
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 tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_mdx.data
test_suite_mdx.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_memory_buffer_alloc.data More accurate test case description 2019-11-26 18:44:55 +01:00
test_suite_memory_buffer_alloc.function Enable more test cases without MBEDTLS_MEMORY_DEBUG 2019-11-26 18:45:00 +01:00
test_suite_mpi.data Add mpi_sub_abs negative tests with a larger-in-size second operand 2021-02-01 17:27:04 +01:00
test_suite_mpi.function Merge branch 'mbedtls-2.16-restricted' into mbedtls-2.16.9r0-pr 2020-12-08 21:00:17 +00:00
test_suite_nist_kw.data
test_suite_nist_kw.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_pem.data
test_suite_pem.function
test_suite_pk.data
test_suite_pk.function tests: Get rid of mbedtls_test_unhexify() in unit test code 2020-06-26 10:19:21 +02:00
test_suite_pkcs1_v15.data
test_suite_pkcs1_v15.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_pkcs1_v21.data
test_suite_pkcs1_v21.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_pkcs5.data
test_suite_pkcs5.function tests: Reformating due to hexcmp() renaming 2020-07-30 15:51:41 +02:00
test_suite_pkparse.data Test each failure mode of pk_parse_key_pkcs1_der() 2020-02-18 10:49:06 +01:00
test_suite_pkparse.function Clean up test function pk_parse_key 2020-02-18 10:49:06 +01:00
test_suite_pkwrite.data
test_suite_pkwrite.function Remove Extraneous bytes from buffer post pem write 2020-12-07 16:47:02 +00:00
test_suite_poly1305.data
test_suite_poly1305.function tests: Replace "TEST_ASSERT(!memcmp ...)" by ASSERT_COMPARE 2020-07-30 16:08:50 +02:00
test_suite_rsa.data Reduce stack usage of test_suite_rsa 2019-09-25 14:51:19 +03:00
test_suite_rsa.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_shax.data Merge remote-tracking branch 'public/pr/2271' into development 2018-12-20 12:15:08 +00:00
test_suite_shax.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_ssl.data Add mbedtls_ssl_cf_memcpy_offset() with tests 2020-08-25 11:18:11 +02:00
test_suite_ssl.function Add mbedtls_ssl_cf_memcpy_offset() with tests 2020-08-25 11:18:11 +02:00
test_suite_timing.data Reduce the timing tests complexity 2019-01-29 13:02:19 +01:00
test_suite_timing.function Correct code formatting in the timing test suites 2019-02-05 10:05:01 +01:00
test_suite_version.data Bump version to Mbed TLS 2.16.9 2020-12-09 01:21:50 +00:00
test_suite_version.function
test_suite_x509parse.data Merge branch 'mbedtls-2.16-restricted' into mbedtls-2.16.9r0-pr 2020-12-08 21:00:17 +00:00
test_suite_x509parse.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00
test_suite_x509write.data Update certificates to expire in 2029 2019-07-10 18:35:10 +03:00
test_suite_x509write.function Remove Extraneous bytes from buffer post pem write 2020-12-07 16:47:02 +00:00
test_suite_xtea.data
test_suite_xtea.function tests: suites: Remove hex in name of variables of type data_t 2020-07-30 15:59:46 +02:00