Fix test functions and data after moving hexify/unhexify out
- Separate string and hex parameter as unhexify is moved out of the function. It's input should only be hex.
- Fix test mbedtls_ccm_encrypt_and_tag that grows input message buffer with tag
- Add missing expected length parameter in ECP TLS tests
- Add deleted TEST_ASSERT and mbedtls calls that got removed in script based code generation
diff --git a/tests/suites/test_suite_cipher.function b/tests/suites/test_suite_cipher.function
index e2463a8..435c9a3 100644
--- a/tests/suites/test_suite_cipher.function
+++ b/tests/suites/test_suite_cipher.function
@@ -534,8 +534,8 @@
void auth_crypt_tv( int cipher_id, uint8_t * key, uint32_t key_len,
uint8_t * iv, uint32_t iv_len, uint8_t * ad,
uint32_t ad_len, uint8_t * cipher, uint32_t cipher_len,
- uint8_t * tag, uint32_t tag_len, uint8_t * clear,
- uint32_t clear_len )
+ uint8_t * tag, uint32_t tag_len, char * result,
+ uint8_t * clear, uint32_t clear_len )
{
int ret;
unsigned char output[267]; /* above + 2 (overwrite check) */
@@ -546,6 +546,7 @@
mbedtls_cipher_init( &ctx );
memset( output, 0xFF, sizeof( output ) );
+ memset( my_tag, 0xFF, sizeof( my_tag ) );
/* Prepare context */
@@ -563,7 +564,7 @@
TEST_ASSERT( output[outlen + 1] == 0xFF );
/* make sure the message is rejected if it should be */
- if( strcmp( clear, "FAIL" ) == 0 )
+ if( strcmp( result, "FAIL" ) == 0 )
{
TEST_ASSERT( ret == MBEDTLS_ERR_CIPHER_AUTH_FAILED );
goto exit;