1
0
Fork 0
mirror of https://github.com/yuzu-emu/mbedtls.git synced 2025-01-11 18:45:28 +00:00

tests: Add mbedtls_test_ prefix to unhexify_alloc()

Add mbedtls_test_ prefix to unhexify_alloc() test helper
functions.

Command to change *.function files:
find . -name "*.function" -exec awk -i inplace \
    '{sub(/unhexify_alloc\>/,"mbedtls_test_&")}1' {} \;

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-06-10 10:53:11 +02:00
parent 690f3ebe92
commit a256c7025f
4 changed files with 16 additions and 16 deletions

View file

@ -77,7 +77,7 @@ unsigned char *mbedtls_test_zero_alloc( size_t len );
*
* For convenience, dies if allocation fails.
*/
unsigned char *unhexify_alloc( const char *ibuf, size_t *olen );
unsigned char *mbedtls_test_unhexify_alloc( const char *ibuf, size_t *olen );
int hexcmp( uint8_t * a, uint8_t * b, uint32_t a_len, uint32_t b_len );

View file

@ -113,7 +113,7 @@ unsigned char *mbedtls_test_zero_alloc( size_t len )
return( p );
}
unsigned char *unhexify_alloc( const char *ibuf, size_t *olen )
unsigned char *mbedtls_test_unhexify_alloc( const char *ibuf, size_t *olen )
{
unsigned char *obuf;

View file

@ -119,14 +119,14 @@ void aes_encrypt_xts( char *hex_key_string, char *hex_data_unit_string,
mbedtls_aes_xts_init( &ctx );
data_unit = unhexify_alloc( hex_data_unit_string, &data_unit_len );
data_unit = mbedtls_test_unhexify_alloc( hex_data_unit_string, &data_unit_len );
TEST_ASSERT( data_unit_len == AES_BLOCK_SIZE );
key = unhexify_alloc( hex_key_string, &key_len );
key = mbedtls_test_unhexify_alloc( hex_key_string, &key_len );
TEST_ASSERT( key_len % 2 == 0 );
src = unhexify_alloc( hex_src_string, &src_len );
dst = unhexify_alloc( hex_dst_string, &dst_len );
src = mbedtls_test_unhexify_alloc( hex_src_string, &src_len );
dst = mbedtls_test_unhexify_alloc( hex_dst_string, &dst_len );
TEST_ASSERT( src_len == dst_len );
output = mbedtls_test_zero_alloc( dst_len );
@ -162,14 +162,14 @@ void aes_decrypt_xts( char *hex_key_string, char *hex_data_unit_string,
mbedtls_aes_xts_init( &ctx );
data_unit = unhexify_alloc( hex_data_unit_string, &data_unit_len );
data_unit = mbedtls_test_unhexify_alloc( hex_data_unit_string, &data_unit_len );
TEST_ASSERT( data_unit_len == AES_BLOCK_SIZE );
key = unhexify_alloc( hex_key_string, &key_len );
key = mbedtls_test_unhexify_alloc( hex_key_string, &key_len );
TEST_ASSERT( key_len % 2 == 0 );
src = unhexify_alloc( hex_src_string, &src_len );
dst = unhexify_alloc( hex_dst_string, &dst_len );
src = mbedtls_test_unhexify_alloc( hex_src_string, &src_len );
dst = mbedtls_test_unhexify_alloc( hex_dst_string, &dst_len );
TEST_ASSERT( src_len == dst_len );
output = mbedtls_test_zero_alloc( dst_len );

View file

@ -63,9 +63,9 @@ void test_hkdf_extract( int md_alg, char *hex_ikm_string,
output_prk_len = mbedtls_md_get_size( md );
output_prk = mbedtls_calloc( 1, output_prk_len );
ikm = unhexify_alloc( hex_ikm_string, &ikm_len );
salt = unhexify_alloc( hex_salt_string, &salt_len );
prk = unhexify_alloc( hex_prk_string, &prk_len );
ikm = mbedtls_test_unhexify_alloc( hex_ikm_string, &ikm_len );
salt = mbedtls_test_unhexify_alloc( hex_salt_string, &salt_len );
prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len );
TEST_ASSERT( prk_len == output_prk_len );
ret = mbedtls_hkdf_extract( md, salt, salt_len, ikm, ikm_len, output_prk );
@ -98,9 +98,9 @@ void test_hkdf_expand( int md_alg, char *hex_info_string,
output_okm = mbedtls_calloc( OKM_LEN, 1 );
prk = unhexify_alloc( hex_prk_string, &prk_len );
info = unhexify_alloc( hex_info_string, &info_len );
okm = unhexify_alloc( hex_okm_string, &okm_len );
prk = mbedtls_test_unhexify_alloc( hex_prk_string, &prk_len );
info = mbedtls_test_unhexify_alloc( hex_info_string, &info_len );
okm = mbedtls_test_unhexify_alloc( hex_okm_string, &okm_len );
TEST_ASSERT( prk_len == mbedtls_md_get_size( md ) );
TEST_ASSERT( okm_len < OKM_LEN );