mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 14:44:15 +01:00
Use mbedtls_printf instead of printf
Replace usages of `printf()` with `mbedtls_printf()` in `aria.c` which were accidently merged. Fixes #1908
This commit is contained in:
parent
d8f41698d2
commit
d1a4762adb
@ -10,6 +10,7 @@ Bugfix
|
|||||||
* Add ecc extensions only if an ecc based ciphersuite is used.
|
* Add ecc extensions only if an ecc based ciphersuite is used.
|
||||||
This improves compliance to RFC 4492, and as a result, solves
|
This improves compliance to RFC 4492, and as a result, solves
|
||||||
interoperability issues with BouncyCastle. Raised by milenamil in #1157.
|
interoperability issues with BouncyCastle. Raised by milenamil in #1157.
|
||||||
|
* Replace printf with mbedtls_printf in aria. Found by TrinityTonic in #1908.
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Copy headers preserving timestamps when doing a "make install".
|
* Copy headers preserving timestamps when doing a "make install".
|
||||||
|
@ -875,11 +875,11 @@ static const uint8_t aria_test2_ctr_ct[3][48] = // CTR ciphertext
|
|||||||
#define ARIA_SELF_TEST_IF_FAIL \
|
#define ARIA_SELF_TEST_IF_FAIL \
|
||||||
{ \
|
{ \
|
||||||
if( verbose ) \
|
if( verbose ) \
|
||||||
printf( "failed\n" ); \
|
mbedtls_printf( "failed\n" ); \
|
||||||
return( 1 ); \
|
return( 1 ); \
|
||||||
} else { \
|
} else { \
|
||||||
if( verbose ) \
|
if( verbose ) \
|
||||||
printf( "passed\n" ); \
|
mbedtls_printf( "passed\n" ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -908,7 +908,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
{
|
{
|
||||||
/* test ECB encryption */
|
/* test ECB encryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-ECB-%d (enc): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-ECB-%d (enc): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test1_ecb_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test1_ecb_key, 128 + 64 * i );
|
||||||
mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_pt, blk );
|
mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_pt, blk );
|
||||||
if( memcmp( blk, aria_test1_ecb_ct[i], MBEDTLS_ARIA_BLOCKSIZE ) != 0 )
|
if( memcmp( blk, aria_test1_ecb_ct[i], MBEDTLS_ARIA_BLOCKSIZE ) != 0 )
|
||||||
@ -916,14 +916,14 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
|
|
||||||
/* test ECB decryption */
|
/* test ECB decryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-ECB-%d (dec): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-ECB-%d (dec): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_dec( &ctx, aria_test1_ecb_key, 128 + 64 * i );
|
mbedtls_aria_setkey_dec( &ctx, aria_test1_ecb_key, 128 + 64 * i );
|
||||||
mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_ct[i], blk );
|
mbedtls_aria_crypt_ecb( &ctx, aria_test1_ecb_ct[i], blk );
|
||||||
if( memcmp( blk, aria_test1_ecb_pt, MBEDTLS_ARIA_BLOCKSIZE ) != 0 )
|
if( memcmp( blk, aria_test1_ecb_pt, MBEDTLS_ARIA_BLOCKSIZE ) != 0 )
|
||||||
ARIA_SELF_TEST_IF_FAIL;
|
ARIA_SELF_TEST_IF_FAIL;
|
||||||
}
|
}
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "\n" );
|
mbedtls_printf( "\n" );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Test set 2
|
* Test set 2
|
||||||
@ -933,7 +933,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
{
|
{
|
||||||
/* Test CBC encryption */
|
/* Test CBC encryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CBC-%d (enc): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CBC-%d (enc): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||||
memset( buf, 0x55, sizeof( buf ) );
|
memset( buf, 0x55, sizeof( buf ) );
|
||||||
@ -944,7 +944,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
|
|
||||||
/* Test CBC decryption */
|
/* Test CBC decryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CBC-%d (dec): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CBC-%d (dec): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_dec( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_dec( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||||
memset( buf, 0xAA, sizeof( buf ) );
|
memset( buf, 0xAA, sizeof( buf ) );
|
||||||
@ -954,7 +954,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
ARIA_SELF_TEST_IF_FAIL;
|
ARIA_SELF_TEST_IF_FAIL;
|
||||||
}
|
}
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "\n" );
|
mbedtls_printf( "\n" );
|
||||||
|
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
#endif /* MBEDTLS_CIPHER_MODE_CBC */
|
||||||
|
|
||||||
@ -963,7 +963,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
{
|
{
|
||||||
/* Test CFB encryption */
|
/* Test CFB encryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CFB-%d (enc): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CFB-%d (enc): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||||
memset( buf, 0x55, sizeof( buf ) );
|
memset( buf, 0x55, sizeof( buf ) );
|
||||||
@ -975,7 +975,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
|
|
||||||
/* Test CFB decryption */
|
/* Test CFB decryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CFB-%d (dec): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CFB-%d (dec): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
memcpy( iv, aria_test2_iv, MBEDTLS_ARIA_BLOCKSIZE );
|
||||||
memset( buf, 0xAA, sizeof( buf ) );
|
memset( buf, 0xAA, sizeof( buf ) );
|
||||||
@ -986,7 +986,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
ARIA_SELF_TEST_IF_FAIL;
|
ARIA_SELF_TEST_IF_FAIL;
|
||||||
}
|
}
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "\n" );
|
mbedtls_printf( "\n" );
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
#endif /* MBEDTLS_CIPHER_MODE_CFB */
|
||||||
|
|
||||||
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
#if defined(MBEDTLS_CIPHER_MODE_CTR)
|
||||||
@ -994,7 +994,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
{
|
{
|
||||||
/* Test CTR encryption */
|
/* Test CTR encryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CTR-%d (enc): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
|
memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
|
||||||
memset( buf, 0x55, sizeof( buf ) );
|
memset( buf, 0x55, sizeof( buf ) );
|
||||||
@ -1006,7 +1006,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
|
|
||||||
/* Test CTR decryption */
|
/* Test CTR decryption */
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i );
|
mbedtls_printf( " ARIA-CTR-%d (dec): ", 128 + 64 * i );
|
||||||
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
mbedtls_aria_setkey_enc( &ctx, aria_test2_key, 128 + 64 * i );
|
||||||
memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
|
memset( iv, 0, MBEDTLS_ARIA_BLOCKSIZE ); // IV = 0
|
||||||
memset( buf, 0xAA, sizeof( buf ) );
|
memset( buf, 0xAA, sizeof( buf ) );
|
||||||
@ -1017,7 +1017,7 @@ int mbedtls_aria_self_test( int verbose )
|
|||||||
ARIA_SELF_TEST_IF_FAIL;
|
ARIA_SELF_TEST_IF_FAIL;
|
||||||
}
|
}
|
||||||
if( verbose )
|
if( verbose )
|
||||||
printf( "\n" );
|
mbedtls_printf( "\n" );
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
Loading…
Reference in New Issue
Block a user