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
This commit is contained in:
Azim Khan 2017-05-31 20:46:35 +01:00 committed by Mohammad Azim Khan
parent 5e7f8df800
commit 46c9b1f196
18 changed files with 795 additions and 790 deletions

View file

@ -534,8 +534,8 @@ exit:
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 @@ void auth_crypt_tv( int cipher_id, uint8_t * key, uint32_t key_len,
mbedtls_cipher_init( &ctx );
memset( output, 0xFF, sizeof( output ) );
memset( my_tag, 0xFF, sizeof( my_tag ) );
/* Prepare context */
@ -563,7 +564,7 @@ void auth_crypt_tv( int cipher_id, uint8_t * key, uint32_t key_len,
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;