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

@ -15,8 +15,7 @@ void des_check_weak( data_t * key, int ret )
/* END_CASE */
/* BEGIN_CASE */
void des_encrypt_ecb( data_t * key_str, data_t * src_str,
data_t * hex_dst_string )
void des_encrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_des_context ctx;
@ -28,8 +27,7 @@ void des_encrypt_ecb( data_t * key_str, data_t * src_str,
mbedtls_des_setkey_enc( &ctx, key_str->x );
TEST_ASSERT( mbedtls_des_crypt_ecb( &ctx, 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 );
exit:
mbedtls_des_free( &ctx );
@ -37,8 +35,7 @@ exit:
/* END_CASE */
/* BEGIN_CASE */
void des_decrypt_ecb( data_t * key_str, data_t * src_str,
data_t * hex_dst_string )
void des_decrypt_ecb( data_t * key_str, data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_des_context ctx;
@ -50,8 +47,7 @@ void des_decrypt_ecb( data_t * key_str, data_t * src_str,
mbedtls_des_setkey_dec( &ctx, key_str->x );
TEST_ASSERT( mbedtls_des_crypt_ecb( &ctx, 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 );
exit:
mbedtls_des_free( &ctx );
@ -60,8 +56,7 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void des_encrypt_cbc( data_t * key_str, data_t * iv_str,
data_t * src_str, data_t * hex_dst_string,
int cbc_result )
data_t * src_str, data_t * dst, int cbc_result )
{
unsigned char output[100];
mbedtls_des_context ctx;
@ -75,9 +70,8 @@ void des_encrypt_cbc( data_t * key_str, data_t * iv_str,
if( cbc_result == 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 );
}
exit:
@ -87,7 +81,7 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void des_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,
int cbc_result )
{
unsigned char output[100];
@ -102,9 +96,8 @@ void des_decrypt_cbc( data_t * key_str, data_t * iv_str,
if( cbc_result == 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 );
}
exit:
@ -114,7 +107,7 @@ exit:
/* BEGIN_CASE */
void des3_encrypt_ecb( int key_count, data_t * key_str,
data_t * src_str, data_t * hex_dst_string )
data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_des3_context ctx;
@ -132,8 +125,7 @@ void des3_encrypt_ecb( int key_count, data_t * key_str,
TEST_ASSERT( mbedtls_des3_crypt_ecb( &ctx, 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 );
exit:
mbedtls_des3_free( &ctx );
@ -142,7 +134,7 @@ exit:
/* BEGIN_CASE */
void des3_decrypt_ecb( int key_count, data_t * key_str,
data_t * src_str, data_t * hex_dst_string )
data_t * src_str, data_t * dst )
{
unsigned char output[100];
mbedtls_des3_context ctx;
@ -160,8 +152,7 @@ void des3_decrypt_ecb( int key_count, data_t * key_str,
TEST_ASSERT( mbedtls_des3_crypt_ecb( &ctx, 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 );
exit:
mbedtls_des3_free( &ctx );
@ -171,7 +162,7 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void des3_encrypt_cbc( int key_count, data_t * key_str,
data_t * iv_str, data_t * src_str,
data_t * hex_dst_string, int cbc_result )
data_t * dst, int cbc_result )
{
unsigned char output[100];
mbedtls_des3_context ctx;
@ -192,9 +183,8 @@ void des3_encrypt_cbc( int key_count, data_t * key_str,
if( cbc_result == 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 );
}
exit:
@ -205,7 +195,7 @@ exit:
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
void des3_decrypt_cbc( int key_count, data_t * key_str,
data_t * iv_str, data_t * src_str,
data_t * hex_dst_string, int cbc_result )
data_t * dst, int cbc_result )
{
unsigned char output[100];
mbedtls_des3_context ctx;
@ -226,9 +216,8 @@ void des3_decrypt_cbc( int key_count, data_t * key_str,
if( cbc_result == 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 );
}
exit: