tests: Reformating due to hexcmp() renaming

Command to find the files in which lines have gone
larger than 79 characters due to the renaming:

grep '.\{80\}' \
`git diff-tree --no-commit-id --name-only -r HEAD` \
| grep hexcmp

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-06-10 11:42:32 +02:00
parent de70b165a4
commit 2dbba99708
15 changed files with 187 additions and 76 deletions

View file

@ -23,7 +23,8 @@ 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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
}
exit:
@ -47,7 +48,8 @@ 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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
}
exit:
@ -72,7 +74,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -96,7 +100,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -243,7 +249,8 @@ 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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
exit:
mbedtls_aes_free( &ctx );
@ -265,7 +272,8 @@ 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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
exit:
mbedtls_aes_free( &ctx );
@ -286,7 +294,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_aes_free( &ctx );
@ -307,7 +317,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_aes_free( &ctx );

View file

@ -21,7 +21,9 @@ void mbedtls_arc4_crypt( data_t * src_str, data_t * key_str,
mbedtls_arc4_setup(&ctx, key_str->x, key_str->len);
TEST_ASSERT( mbedtls_arc4_crypt(&ctx, src_str->len, src_str->x, dst_str ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( dst_str, hex_dst_string->x, src_str->len, hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( dst_str, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_arc4_free( &ctx );

View file

@ -181,7 +181,8 @@ void blowfish_encrypt_ecb( data_t * key_str, data_t * src_str,
{
TEST_ASSERT( mbedtls_blowfish_crypt_ecb( &ctx, MBEDTLS_BLOWFISH_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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
}
exit:
@ -205,7 +206,8 @@ void blowfish_decrypt_ecb( data_t * key_str, data_t * src_str,
{
TEST_ASSERT( mbedtls_blowfish_crypt_ecb( &ctx, MBEDTLS_BLOWFISH_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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
}
exit:
@ -231,7 +233,9 @@ void blowfish_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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -256,7 +260,9 @@ void blowfish_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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -280,7 +286,9 @@ void blowfish_encrypt_cfb64( data_t * key_str, data_t * iv_str,
mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
TEST_ASSERT( mbedtls_blowfish_crypt_cfb64( &ctx, MBEDTLS_BLOWFISH_ENCRYPT, src_str->len, &iv_offset, 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_blowfish_free( &ctx );
@ -303,7 +311,9 @@ void blowfish_decrypt_cfb64( data_t * key_str, data_t * iv_str,
mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
TEST_ASSERT( mbedtls_blowfish_crypt_cfb64( &ctx, MBEDTLS_BLOWFISH_DECRYPT, src_str->len, &iv_offset, 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_blowfish_free( &ctx );
@ -327,7 +337,9 @@ void blowfish_encrypt_ctr( data_t * key_str, data_t * iv_str,
mbedtls_blowfish_setkey( &ctx, key_str->x, key_str->len * 8 );
TEST_ASSERT( mbedtls_blowfish_crypt_ctr( &ctx, src_str->len, &iv_offset, iv_str->x, stream_str, 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
exit:
mbedtls_blowfish_free( &ctx );

View file

@ -189,7 +189,8 @@ void camellia_encrypt_ecb( data_t * key_str, data_t * src_str,
{
TEST_ASSERT( mbedtls_camellia_crypt_ecb( &ctx, MBEDTLS_CAMELLIA_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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
}
exit:
@ -213,7 +214,8 @@ void camellia_decrypt_ecb( data_t * key_str, data_t * src_str,
{
TEST_ASSERT( mbedtls_camellia_crypt_ecb( &ctx, MBEDTLS_CAMELLIA_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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
}
exit:
@ -238,7 +240,9 @@ void camellia_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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -263,7 +267,9 @@ void camellia_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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -287,7 +293,8 @@ void camellia_encrypt_cfb128( data_t * key_str, data_t * iv_str,
mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
TEST_ASSERT( mbedtls_camellia_crypt_cfb128( &ctx, MBEDTLS_CAMELLIA_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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
exit:
mbedtls_camellia_free( &ctx );
@ -310,7 +317,8 @@ void camellia_decrypt_cfb128( data_t * key_str, data_t * iv_str,
mbedtls_camellia_setkey_enc( &ctx, key_str->x, key_str->len * 8 );
TEST_ASSERT( mbedtls_camellia_crypt_cfb128( &ctx, MBEDTLS_CAMELLIA_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, hex_dst_string->x,
16, hex_dst_string->len ) == 0 );
exit:
mbedtls_camellia_free( &ctx );

View file

@ -28,7 +28,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
exit:
mbedtls_des_free( &ctx );
@ -49,7 +50,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
exit:
mbedtls_des_free( &ctx );
@ -73,7 +75,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -98,7 +102,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -126,7 +132,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
exit:
mbedtls_des3_free( &ctx );
@ -153,7 +160,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
exit:
mbedtls_des3_free( &ctx );
@ -184,7 +192,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:
@ -216,7 +226,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
exit:

View file

@ -55,8 +55,11 @@ void gcm_encrypt_and_tag( int cipher_id, data_t * key_str,
{
TEST_ASSERT( mbedtls_gcm_crypt_and_tag( &ctx, MBEDTLS_GCM_ENCRYPT, src_str->len, iv_str->x, iv_str->len, add_str->x, add_str->len, src_str->x, output, tag_len, tag_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( tag_output, hex_tag_string->x, tag_len, hex_tag_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( tag_output, hex_tag_string->x,
tag_len, hex_tag_string->len ) == 0 );
}
exit:
@ -94,7 +97,9 @@ void gcm_decrypt_and_verify( int cipher_id, data_t * key_str,
{
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, pt_result->x, src_str->len, pt_result->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, pt_result->x,
src_str->len,
pt_result->len ) == 0 );
}
}

View file

@ -145,7 +145,9 @@ void md_text( char * text_md_name, char * text_src_string,
TEST_ASSERT ( 0 == mbedtls_md( md_info, src_str, strlen( (char *) src_str ), output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -168,7 +170,8 @@ void md_hex( char * text_md_name, data_t * src_str,
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -209,14 +212,17 @@ void md_text_multi( char * text_md_name, char * text_src_string,
TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str + halfway, len - halfway ) );
TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ), hex_hash_string->len) == 0 );
mbedtls_md_get_size( md_info ),
hex_hash_string->len) == 0 );
/* Test clone */
memset( output, 0x00, 100 );
TEST_ASSERT ( 0 == mbedtls_md_update( &ctx_copy, src_str + halfway, len - halfway ) );
TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx_copy, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
exit:
mbedtls_md_free( &ctx );
@ -255,14 +261,18 @@ void md_hex_multi( char * text_md_name, data_t * src_str,
TEST_ASSERT ( 0 == mbedtls_md_update( &ctx, src_str->x + halfway, src_str->len - halfway) );
TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
/* Test clone */
memset( output, 0x00, 100 );
TEST_ASSERT ( 0 == mbedtls_md_update( &ctx_copy, src_str->x + halfway, src_str->len - halfway ) );
TEST_ASSERT ( 0 == mbedtls_md_finish( &ctx_copy, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
exit:
mbedtls_md_free( &ctx );
@ -289,7 +299,8 @@ void mbedtls_md_hmac( char * text_md_name, int trunc_size,
TEST_ASSERT ( mbedtls_md_hmac( md_info, key_str->x, key_str->len, src_str->x, src_str->len, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, trunc_size, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
trunc_size, hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -321,7 +332,8 @@ void md_hmac_multi( char * text_md_name, int trunc_size, data_t * key_str,
TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x + halfway, src_str->len - halfway ) );
TEST_ASSERT ( 0 == mbedtls_md_hmac_finish( &ctx, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, trunc_size, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
trunc_size, hex_hash_string->len ) == 0 );
/* Test again, for reset() */
memset( output, 0x00, 100 );
@ -331,7 +343,8 @@ void md_hmac_multi( char * text_md_name, int trunc_size, data_t * key_str,
TEST_ASSERT ( 0 == mbedtls_md_hmac_update( &ctx, src_str->x + halfway, src_str->len - halfway ) );
TEST_ASSERT ( 0 == mbedtls_md_hmac_finish( &ctx, output ) );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, trunc_size, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
trunc_size, hex_hash_string->len ) == 0 );
exit:
mbedtls_md_free( &ctx );
@ -355,6 +368,8 @@ void mbedtls_md_file( char * text_md_name, char * filename,
TEST_ASSERT( mbedtls_md_file( md_info, filename, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, mbedtls_md_get_size( md_info ), hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
mbedtls_md_get_size( md_info ),
hex_hash_string->len ) == 0 );
}
/* END_CASE */

View file

@ -20,7 +20,9 @@ void md2_text( char * text_src_string, data_t * hex_hash_string )
ret = mbedtls_md2_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 ) ;
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, sizeof output, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
sizeof output,
hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -39,7 +41,9 @@ void md4_text( char * text_src_string, data_t * hex_hash_string )
ret = mbedtls_md4_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, sizeof output, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
sizeof output,
hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -58,7 +62,9 @@ void md5_text( char * text_src_string, data_t * hex_hash_string )
ret = mbedtls_md5_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, sizeof output, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
sizeof output,
hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -77,7 +83,9 @@ void ripemd160_text( char * text_src_string, data_t * hex_hash_string )
ret = mbedtls_ripemd160_ret( src_str, strlen( (char *) src_str ), output );
TEST_ASSERT( ret == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, sizeof output, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
sizeof output,
hex_hash_string->len ) == 0 );
}
/* END_CASE */

View file

@ -373,7 +373,8 @@ void mbedtls_mpi_write_binary( int radix_X, char * input_X,
if( result == 0)
{
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x, buflen, input_A->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
buflen, input_A->len ) == 0 );
}
exit:
@ -404,7 +405,8 @@ void mbedtls_mpi_write_binary_le( int radix_X, char * input_X,
if( result == 0)
{
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x, buflen, input_A->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
buflen, input_A->len ) == 0 );
}
exit:
@ -438,7 +440,8 @@ void mbedtls_mpi_read_file( int radix_X, char * input_file,
TEST_ASSERT( mbedtls_mpi_write_binary( &X, buf, buflen ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x, buflen, input_A->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( buf, input_A->x,
buflen, input_A->len ) == 0 );
}
exit:

View file

@ -37,7 +37,8 @@ void pkcs1_rsaes_v15_encrypt( int mod, int radix_N, char * input_N,
TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx, &rnd_buffer_rand, &info, MBEDTLS_RSA_PUBLIC, message_str->len, message_str->x, output ) == result );
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -87,7 +88,9 @@ void pkcs1_rsaes_v15_decrypt( int mod, int radix_P, char * input_P,
TEST_ASSERT( mbedtls_rsa_pkcs1_decrypt( &ctx, &rnd_pseudo_rand, &rnd_info, MBEDTLS_RSA_PRIVATE, &output_len, message_str->x, output, 1000 ) == result );
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, output_len, result_hex_str->len) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
output_len,
result_hex_str->len) == 0 );
}
}
@ -287,7 +290,8 @@ void pkcs1_rsassa_v15_sign( int mod, int radix_P, char * input_P, int radix_Q,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:

View file

@ -37,7 +37,8 @@ void pkcs1_rsaes_oaep_encrypt( int mod, int radix_N, char * input_N,
TEST_ASSERT( mbedtls_rsa_pkcs1_encrypt( &ctx, &rnd_buffer_rand, &info, MBEDTLS_RSA_PUBLIC, message_str->len, message_str->x, output ) == result );
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -93,7 +94,9 @@ void pkcs1_rsaes_oaep_decrypt( int mod, int radix_P, char * input_P,
sizeof( output ) ) == result );
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, output_len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
output_len,
result_hex_str->len ) == 0 );
}
}
@ -146,7 +149,8 @@ void pkcs1_rsassa_pss_sign( int mod, int radix_P, char * input_P, int radix_Q,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:

View file

@ -24,7 +24,8 @@ void pbkdf2_hmac( int hash, data_t * pw_str, data_t * salt_str,
TEST_ASSERT( mbedtls_pkcs5_pbkdf2_hmac( &ctx, pw_str->x, pw_str->len, salt_str->x, salt_str->len,
it_cnt, key_len, key ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x, key_len, result_key_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( key, result_key_string->x,
key_len, result_key_string->len ) == 0 );
exit:
mbedtls_md_free( &ctx );

View file

@ -506,7 +506,8 @@ void mbedtls_rsa_pkcs1_sign( data_t * message_str, int padding_mode,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -586,7 +587,8 @@ void rsa_pkcs1_sign_raw( data_t * hash_result,
output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
#if defined(MBEDTLS_PKCS1_V15)
/* For PKCS#1 v1.5, there is an alternative way to generate signatures */
@ -608,7 +610,9 @@ void rsa_pkcs1_sign_raw( data_t * hash_result,
if( res == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len,
result_hex_str->len ) == 0 );
}
}
#endif /* MBEDTLS_PKCS1_V15 */
@ -714,7 +718,8 @@ void mbedtls_rsa_pkcs1_encrypt( data_t * message_str, int padding_mode,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -752,7 +757,8 @@ void rsa_pkcs1_encrypt_bad_rng( data_t * message_str, int padding_mode,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -800,7 +806,9 @@ void mbedtls_rsa_pkcs1_decrypt( data_t * message_str, int padding_mode,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, output_len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
output_len,
result_hex_str->len ) == 0 );
}
exit:
@ -837,7 +845,8 @@ void mbedtls_rsa_public( data_t * message_str, int mod, int radix_N,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
/* And now with the copy */
@ -852,7 +861,8 @@ void mbedtls_rsa_public( data_t * message_str, int mod, int radix_N,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len, result_hex_str->len ) == 0 );
}
exit:
@ -902,7 +912,9 @@ void mbedtls_rsa_private( data_t * message_str, int mod, int radix_P,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx.len,
result_hex_str->len ) == 0 );
}
}
@ -919,7 +931,9 @@ void mbedtls_rsa_private( data_t * message_str, int mod, int radix_P,
if( result == 0 )
{
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x, ctx2.len, result_hex_str->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, result_hex_str->x,
ctx2.len,
result_hex_str->len ) == 0 );
}
exit:

View file

@ -61,7 +61,8 @@ void mbedtls_sha1( data_t * src_str, data_t * hex_hash_string )
TEST_ASSERT( mbedtls_sha1_ret( src_str->x, src_str->len, output ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, 20, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
20, hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -131,7 +132,8 @@ void sha224( data_t * src_str, data_t * hex_hash_string )
TEST_ASSERT( mbedtls_sha256_ret( src_str->x, src_str->len, output, 1 ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, 28, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
28, hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -145,7 +147,8 @@ void mbedtls_sha256( data_t * src_str, data_t * hex_hash_string )
TEST_ASSERT( mbedtls_sha256_ret( src_str->x, src_str->len, output, 0 ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, 32, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
32, hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -215,7 +218,8 @@ void sha384( data_t * src_str, data_t * hex_hash_string )
TEST_ASSERT( mbedtls_sha512_ret( src_str->x, src_str->len, output, 1 ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, 48, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
48, hex_hash_string->len ) == 0 );
}
/* END_CASE */
@ -229,7 +233,8 @@ void mbedtls_sha512( data_t * src_str, data_t * hex_hash_string )
TEST_ASSERT( mbedtls_sha512_ret( src_str->x, src_str->len, output, 0 ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x, 64, hex_hash_string->len ) == 0 );
TEST_ASSERT( mbedtls_test_hexcmp( output, hex_hash_string->x,
64, hex_hash_string->len ) == 0 );
}
/* END_CASE */

View file

@ -20,7 +20,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
}
/* END_CASE */
@ -37,7 +38,8 @@ 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, hex_dst_string->x,
8, hex_dst_string->len ) == 0 );
}
/* END_CASE */
@ -55,7 +57,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
/* END_CASE */
@ -73,7 +77,9 @@ 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, hex_dst_string->x,
src_str->len,
hex_dst_string->len ) == 0 );
}
/* END_CASE */