diff --git a/tests/suites/test_suite_cipher.chacha20.data b/tests/suites/test_suite_cipher.chacha20.data index dfa0e76ad..11bbfa231 100644 --- a/tests/suites/test_suite_cipher.chacha20.data +++ b/tests/suites/test_suite_cipher.chacha20.data @@ -116,20 +116,20 @@ enc_dec_buf_multipart:MBEDTLS_CIPHER_CHACHA20:256:16:16:-1:16:16:16:16 ChaCha20 IV Length 0 depends_on:MBEDTLS_CHACHA20_C -check_iv:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":0:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":0:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20 IV Length 11 depends_on:MBEDTLS_CHACHA20_C -check_iv:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":11:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":11:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20 IV Length 12 depends_on:MBEDTLS_CHACHA20_C -check_iv:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":12:0 +iv_len_validity:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":12:0 ChaCha20 IV Length 13 depends_on:MBEDTLS_CHACHA20_C -check_iv:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":13:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":13:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20 IV Length 16 depends_on:MBEDTLS_CHACHA20_C -check_iv:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":16:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20:"CHACHA20":16:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA diff --git a/tests/suites/test_suite_cipher.chachapoly.data b/tests/suites/test_suite_cipher.chachapoly.data index 908951a18..df7891792 100644 --- a/tests/suites/test_suite_cipher.chachapoly.data +++ b/tests/suites/test_suite_cipher.chachapoly.data @@ -124,20 +124,20 @@ decrypt_test_vec:MBEDTLS_CIPHER_CHACHA20_POLY1305:-1:"1c9240a5eb55d38af333888604 ChaCha20+Poly1305 IV Length 0 depends_on:MBEDTLS_CHACHAPOLY_C -check_iv:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":0:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":0:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20+Poly1305 IV Length 11 depends_on:MBEDTLS_CHACHAPOLY_C -check_iv:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":11:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":11:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20+Poly1305 IV Length 12 depends_on:MBEDTLS_CHACHAPOLY_C -check_iv:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":12:0 +iv_len_validity:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":12:0 ChaCha20+Poly1305 IV Length 13 depends_on:MBEDTLS_CHACHAPOLY_C -check_iv:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":13:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":13:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ChaCha20+Poly1305 IV Length 16 depends_on:MBEDTLS_CHACHAPOLY_C -check_iv:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":16:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA +iv_len_validity:MBEDTLS_CIPHER_CHACHA20_POLY1305:"CHACHA20-POLY1305":16:MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function index 03c17331a..93bff1e02 100644 --- a/tests/suites/test_suite_cipher.function +++ b/tests/suites/test_suite_cipher.function @@ -1599,12 +1599,15 @@ void check_padding( int pad_mode, data_t * input, int ret, int dlen_check /* END_CASE */ /* BEGIN_CASE */ -void check_iv( int cipher_id, char * cipher_string, +void iv_len_validity( int cipher_id, char * cipher_string, int iv_len_val, int ret ) { size_t iv_len = iv_len_val; unsigned char iv[16]; + /* Initialise iv buffer */ + memset( iv, 0, sizeof( iv ) ); + const mbedtls_cipher_info_t *cipher_info; mbedtls_cipher_context_t ctx_dec; mbedtls_cipher_context_t ctx_enc; diff --git a/tests/suites/test_suite_md.function b/tests/suites/test_suite_md.function index d918ce3b9..8cbdbe4c7 100644 --- a/tests/suites/test_suite_md.function +++ b/tests/suites/test_suite_md.function @@ -16,6 +16,7 @@ void mbedtls_md_process( ) unsigned char buf[150]; mbedtls_md_init( &ctx ); + memset( buf, 0, sizeof( buf ) ); /* * Very minimal testing of mbedtls_md_process, just make sure the various