diff --git a/tests/suites/test_suite_aria.function b/tests/suites/test_suite_aria.function index 89de82f934..d8a2971b4b 100644 --- a/tests/suites/test_suite_aria.function +++ b/tests/suites/test_suite_aria.function @@ -214,7 +214,7 @@ void aria_encrypt_ecb( char *hex_key_string, char *hex_src_string, unsigned char dst_str[ARIA_MAX_DATA_STR]; unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; - int key_len, data_len, i; + size_t key_len, src_str_len, i; memset( key_str, 0x00, sizeof( key_str ) ); memset( src_str, 0x00, sizeof( src_str ) ); @@ -223,18 +223,18 @@ void aria_encrypt_ecb( char *hex_key_string, char *hex_src_string, mbedtls_aria_init( &ctx ); key_len = mbedtls_test_unhexify( key_str, hex_key_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); TEST_ASSERT( mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ) == setkey_result ); if( setkey_result == 0 ) { - for( i = 0; i < data_len; i += MBEDTLS_ARIA_BLOCKSIZE ) + for( i = 0; i < src_str_len; i += MBEDTLS_ARIA_BLOCKSIZE ) { TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str + i, output + i ) == 0 ); } - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } @@ -253,7 +253,7 @@ void aria_decrypt_ecb( char *hex_key_string, char *hex_src_string, unsigned char dst_str[ARIA_MAX_DATA_STR]; unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; - int key_len, data_len, i; + size_t key_len, src_str_len, i; memset( key_str, 0x00, sizeof( key_str ) ); memset( src_str, 0x00, sizeof( src_str ) ); @@ -262,18 +262,18 @@ void aria_decrypt_ecb( char *hex_key_string, char *hex_src_string, mbedtls_aria_init( &ctx ); key_len = mbedtls_test_unhexify( key_str, hex_key_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); TEST_ASSERT( mbedtls_aria_setkey_dec( &ctx, key_str, key_len * 8 ) == setkey_result ); if( setkey_result == 0 ) { - for( i = 0; i < data_len; i += MBEDTLS_ARIA_BLOCKSIZE ) + for( i = 0; i < src_str_len; i += MBEDTLS_ARIA_BLOCKSIZE ) { TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, src_str + i, output + i ) == 0 ); } - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } @@ -294,7 +294,7 @@ void aria_encrypt_cbc( char *hex_key_string, char *hex_iv_string, unsigned char dst_str[ARIA_MAX_DATA_STR]; unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -305,15 +305,15 @@ void aria_encrypt_cbc( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT, data_len, + TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT, src_str_len, iv_str, src_str, output ) == cbc_result ); if( cbc_result == 0 ) { - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } @@ -334,7 +334,7 @@ void aria_decrypt_cbc( char *hex_key_string, char *hex_iv_string, unsigned char dst_str[ARIA_MAX_DATA_STR]; unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -345,15 +345,15 @@ void aria_decrypt_cbc( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_dec( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT, data_len, + TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT, src_str_len, iv_str, src_str, output ) == cbc_result ); if( cbc_result == 0 ) { - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); } @@ -375,7 +375,7 @@ void aria_encrypt_cfb128( char *hex_key_string, char *hex_iv_string, unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; size_t iv_offset = 0; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -386,14 +386,14 @@ void aria_encrypt_cfb128( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_ENCRYPT, - data_len, &iv_offset, iv_str, + src_str_len, &iv_offset, iv_str, src_str, output ) == result ); - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); @@ -414,7 +414,7 @@ void aria_decrypt_cfb128( char *hex_key_string, char *hex_iv_string, unsigned char output[ARIA_MAX_DATASIZE]; mbedtls_aria_context ctx; size_t iv_offset = 0; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -425,14 +425,14 @@ void aria_decrypt_cfb128( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ); TEST_ASSERT( mbedtls_aria_crypt_cfb128( &ctx, MBEDTLS_ARIA_DECRYPT, - data_len, &iv_offset, iv_str, + src_str_len, &iv_offset, iv_str, src_str, output ) == result ); - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); @@ -454,7 +454,7 @@ void aria_encrypt_ctr( char *hex_key_string, char *hex_iv_string, unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE]; mbedtls_aria_context ctx; size_t iv_offset = 0; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -465,13 +465,13 @@ void aria_encrypt_ctr( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, data_len, &iv_offset, iv_str, + TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str_len, &iv_offset, iv_str, blk, src_str, output ) == result ); - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 ); @@ -493,7 +493,7 @@ void aria_decrypt_ctr( char *hex_key_string, char *hex_iv_string, unsigned char blk[MBEDTLS_ARIA_BLOCKSIZE]; mbedtls_aria_context ctx; size_t iv_offset = 0; - int key_len, data_len; + size_t key_len, src_str_len; memset( key_str, 0x00, sizeof( key_str ) ); memset( iv_str, 0x00, sizeof( iv_str ) ); @@ -504,13 +504,13 @@ void aria_decrypt_ctr( char *hex_key_string, char *hex_iv_string, key_len = mbedtls_test_unhexify( key_str, hex_key_string ); mbedtls_test_unhexify( iv_str, hex_iv_string ); - data_len = mbedtls_test_unhexify( src_str, hex_src_string ); + src_str_len = mbedtls_test_unhexify( src_str, hex_src_string ); mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ); - TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, data_len, &iv_offset, iv_str, + TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, src_str_len, &iv_offset, iv_str, blk, src_str, output ) == result ); - mbedtls_test_hexify( dst_str, output, data_len ); + mbedtls_test_hexify( dst_str, output, src_str_len ); TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );