tests: suites: Remove hex in name of variables of type data_t

Remove `hex` in name of variables of type data_t to reserve it
for variables of type char* that are the hexadecimal
representation of a data buffer.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-06-26 14:33:03 +02:00
parent 9fde353f68
commit aea41df254
15 changed files with 197 additions and 252 deletions

View file

@ -9,7 +9,7 @@
/* BEGIN_CASE */
void xtea_encrypt_ecb( data_t * key_str, data_t * src_str,
data_t * hex_dst_string )
data_t * dst )
{
unsigned char output[100];
mbedtls_xtea_context ctx;
@ -20,14 +20,12 @@ void xtea_encrypt_ecb( data_t * key_str, data_t * src_str,
mbedtls_xtea_setup( &ctx, key_str->x );
TEST_ASSERT( mbedtls_xtea_crypt_ecb( &ctx, MBEDTLS_XTEA_ENCRYPT, src_str->x, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE */
void xtea_decrypt_ecb( data_t * key_str, data_t * src_str,
data_t * hex_dst_string )
void xtea_decrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_xtea_context ctx;
@ -38,14 +36,13 @@ void xtea_decrypt_ecb( data_t * key_str, data_t * src_str,
mbedtls_xtea_setup( &ctx, key_str->x );
TEST_ASSERT( mbedtls_xtea_crypt_ecb( &ctx, MBEDTLS_XTEA_DECRYPT, src_str->x, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 8, dst->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void xtea_encrypt_cbc( data_t * key_str, data_t * iv_str,
data_t * src_str, data_t * hex_dst_string )
data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_xtea_context ctx;
@ -57,15 +54,14 @@ void xtea_encrypt_cbc( data_t * key_str, data_t * iv_str,
TEST_ASSERT( mbedtls_xtea_crypt_cbc( &ctx, MBEDTLS_XTEA_ENCRYPT, src_str->len, iv_str->x,
src_str->x, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
src_str->len, dst->len ) == 0 );
}
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void xtea_decrypt_cbc( data_t * key_str, data_t * iv_str,
data_t * src_str, data_t * hex_dst_string )
data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_xtea_context ctx;
@ -77,9 +73,8 @@ void xtea_decrypt_cbc( data_t * key_str, data_t * iv_str,
TEST_ASSERT( mbedtls_xtea_crypt_cbc( &ctx, MBEDTLS_XTEA_DECRYPT, src_str->len, iv_str->x,
src_str->x, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x,
src_str->len, dst->len ) == 0 );
}
/* END_CASE */