mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-04 21:56:21 +01:00
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:
parent
9fde353f68
commit
aea41df254
15 changed files with 197 additions and 252 deletions
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
/* BEGIN_CASE */
|
||||
void aes_encrypt_ecb( data_t * key_str, data_t * src_str,
|
||||
data_t * hex_dst_string, int setkey_result )
|
||||
data_t * dst, int setkey_result )
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
|
@ -23,8 +23,7 @@ void aes_encrypt_ecb( data_t * key_str, data_t * src_str,
|
|||
{
|
||||
TEST_ASSERT( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_ENCRYPT, src_str->x, output ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
|
||||
16, hex_dst_string->len ) == 0 );
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
|
||||
}
|
||||
|
||||
exit:
|
||||
|
|
@ -34,7 +33,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE */
|
||||
void aes_decrypt_ecb( data_t * key_str, data_t * src_str,
|
||||
data_t * hex_dst_string, int setkey_result )
|
||||
data_t * dst, int setkey_result )
|
||||
{
|
||||
unsigned char output[100];
|
||||
mbedtls_aes_context ctx;
|
||||
|
|
@ -48,8 +47,7 @@ void aes_decrypt_ecb( data_t * key_str, data_t * src_str,
|
|||
{
|
||||
TEST_ASSERT( mbedtls_aes_crypt_ecb( &ctx, MBEDTLS_AES_DECRYPT, src_str->x, output ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
|
||||
16, hex_dst_string->len ) == 0 );
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
|
||||
}
|
||||
|
||||
exit:
|
||||
|
|
@ -59,7 +57,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aes_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,
|
||||
int cbc_result )
|
||||
{
|
||||
unsigned char output[100];
|
||||
|
|
@ -74,9 +72,8 @@ void aes_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:
|
||||
|
|
@ -86,7 +83,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CBC */
|
||||
void aes_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];
|
||||
|
|
@ -100,9 +97,8 @@ void aes_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:
|
||||
|
|
@ -234,7 +230,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_encrypt_cfb128( 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_aes_context ctx;
|
||||
|
|
@ -247,8 +243,7 @@ void aes_encrypt_cfb128( data_t * key_str, data_t * iv_str,
|
|||
mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
|
||||
TEST_ASSERT( mbedtls_aes_crypt_cfb128( &ctx, MBEDTLS_AES_ENCRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
|
||||
16, hex_dst_string->len ) == 0 );
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &ctx );
|
||||
|
|
@ -257,7 +252,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_decrypt_cfb128( 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_aes_context ctx;
|
||||
|
|
@ -270,8 +265,7 @@ void aes_decrypt_cfb128( data_t * key_str, data_t * iv_str,
|
|||
mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
|
||||
TEST_ASSERT( mbedtls_aes_crypt_cfb128( &ctx, MBEDTLS_AES_DECRYPT, 16, &iv_offset, iv_str->x, src_str->x, output ) == 0 );
|
||||
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
|
||||
16, hex_dst_string->len ) == 0 );
|
||||
TEST_ASSERT( mbedtls_test_hexcmp( output, dst->x, 16, dst->len ) == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &ctx );
|
||||
|
|
@ -280,7 +274,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_encrypt_cfb8( 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_aes_context ctx;
|
||||
|
|
@ -292,9 +286,8 @@ void aes_encrypt_cfb8( data_t * key_str, data_t * iv_str,
|
|||
mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
|
||||
TEST_ASSERT( mbedtls_aes_crypt_cfb8( &ctx, MBEDTLS_AES_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 );
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &ctx );
|
||||
|
|
@ -303,7 +296,7 @@ exit:
|
|||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_CIPHER_MODE_CFB */
|
||||
void aes_decrypt_cfb8( 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_aes_context ctx;
|
||||
|
|
@ -315,9 +308,8 @@ void aes_decrypt_cfb8( data_t * key_str, data_t * iv_str,
|
|||
mbedtls_aes_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
|
||||
TEST_ASSERT( mbedtls_aes_crypt_cfb8( &ctx, MBEDTLS_AES_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 );
|
||||
|
||||
exit:
|
||||
mbedtls_aes_free( &ctx );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue