mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-23 15:55:10 +01:00
Fix some whitespace and other style issues
In addition to whitespace: - wrapped a few long lines - added parenthesis to return statements
This commit is contained in:
parent
fdd4354329
commit
4231e7f46f
4 changed files with 120 additions and 109 deletions
|
|
@ -27,12 +27,14 @@ void aria_encrypt_ecb( char *hex_key_string, char *hex_src_string,
|
|||
key_len = unhexify( key_str, hex_key_string );
|
||||
data_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
TEST_ASSERT( mbedtls_aria_setkey_enc( &ctx, key_str, key_len * 8 ) == setkey_result );
|
||||
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 += 16 )
|
||||
{
|
||||
TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, MBEDTLS_ARIA_ENCRYPT, src_str + i, output + i ) == 0 );
|
||||
TEST_ASSERT( mbedtls_aria_crypt_ecb( &ctx, MBEDTLS_ARIA_ENCRYPT,
|
||||
src_str + i, output + i ) == 0 );
|
||||
}
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
|
|
@ -55,16 +57,17 @@ void aria_decrypt_ecb( char *hex_key_string, char *hex_src_string,
|
|||
mbedtls_aria_context ctx;
|
||||
int key_len, data_len, i;
|
||||
|
||||
memset( key_str, 0x00, 1000 );
|
||||
memset( src_str, 0x00, 1000 );
|
||||
memset( dst_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
memset( key_str, 0x00, 1000 );
|
||||
memset( src_str, 0x00, 1000 );
|
||||
memset( dst_str, 0x00, 1000 );
|
||||
memset( output, 0x00, 1000 );
|
||||
mbedtls_aria_init( &ctx );
|
||||
|
||||
key_len = unhexify( key_str, hex_key_string );
|
||||
data_len = unhexify( src_str, hex_src_string );
|
||||
|
||||
TEST_ASSERT( mbedtls_aria_setkey_dec( &ctx, key_str, key_len * 8 ) == setkey_result );
|
||||
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 += 16 )
|
||||
|
|
@ -107,8 +110,9 @@ void aria_encrypt_cbc( char *hex_key_string, char *hex_iv_string,
|
|||
data_len = 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, iv_str, src_str, output) == cbc_result );
|
||||
TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_ENCRYPT, data_len,
|
||||
iv_str, src_str, output )
|
||||
== cbc_result );
|
||||
if( cbc_result == 0 )
|
||||
{
|
||||
hexify( dst_str, output, data_len );
|
||||
|
|
@ -146,8 +150,9 @@ void aria_decrypt_cbc( char *hex_key_string, char *hex_iv_string,
|
|||
data_len = 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, iv_str, src_str, output ) == cbc_result );
|
||||
TEST_ASSERT( mbedtls_aria_crypt_cbc( &ctx, MBEDTLS_ARIA_DECRYPT, data_len,
|
||||
iv_str, src_str, output )
|
||||
== cbc_result );
|
||||
if( cbc_result == 0 )
|
||||
{
|
||||
hexify( dst_str, output, data_len );
|
||||
|
|
@ -187,7 +192,8 @@ void aria_encrypt_cfb128( char *hex_key_string, char *hex_iv_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, output ) == result );
|
||||
data_len, &iv_offset, iv_str,
|
||||
src_str, output ) == result );
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
|
|
@ -224,7 +230,8 @@ void aria_decrypt_cfb128( char *hex_key_string, char *hex_iv_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, output ) == result );
|
||||
data_len, &iv_offset, iv_str,
|
||||
src_str, output ) == result );
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
|
|
@ -261,8 +268,8 @@ void aria_encrypt_ctr( char *hex_key_string, char *hex_iv_string,
|
|||
data_len = 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, blk, src_str, output ) == result );
|
||||
TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, data_len, &iv_offset, iv_str,
|
||||
blk, src_str, output ) == result );
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
|
|
@ -299,8 +306,8 @@ void aria_decrypt_ctr( char *hex_key_string, char *hex_iv_string,
|
|||
data_len = 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, blk, src_str, output ) == result );
|
||||
TEST_ASSERT( mbedtls_aria_crypt_ctr( &ctx, data_len, &iv_offset, iv_str,
|
||||
blk, src_str, output ) == result );
|
||||
hexify( dst_str, output, data_len );
|
||||
|
||||
TEST_ASSERT( strcasecmp( (char *) dst_str, hex_dst_string ) == 0 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue