Merge pull request #4553 from gilles-peskine-arm/aria_alt-3.0
Fix ARIA_ALT header and self-test and CAMELLIA_ALT self-test
This commit is contained in:
commit
8a5304d446
5
ChangeLog.d/aria-alt.txt
Normal file
5
ChangeLog.d/aria-alt.txt
Normal file
@ -0,0 +1,5 @@
|
||||
Bugfix
|
||||
* Fix some issues affecting MBEDTLS_ARIA_ALT implementations: a misplaced
|
||||
directive in a header and a missing initialization in the self-test.
|
||||
* Fix a missing initialization in the Camellia self-test, affecting
|
||||
MBEDTLS_CAMELLIA_ALT implementations.
|
@ -51,14 +51,14 @@
|
||||
|
||||
#define MBEDTLS_ERR_ARIA_INVALID_INPUT_LENGTH -0x005E /**< Invalid data input length. */
|
||||
|
||||
#if !defined(MBEDTLS_ARIA_ALT)
|
||||
// Regular implementation
|
||||
//
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(MBEDTLS_ARIA_ALT)
|
||||
// Regular implementation
|
||||
//
|
||||
|
||||
/**
|
||||
* \brief The ARIA context-type definition.
|
||||
*/
|
||||
|
@ -921,7 +921,7 @@ static const uint8_t aria_test2_ctr_ct[3][48] = // CTR ciphertext
|
||||
{ \
|
||||
if( verbose ) \
|
||||
mbedtls_printf( "failed\n" ); \
|
||||
return( 1 ); \
|
||||
goto exit; \
|
||||
} else { \
|
||||
if( verbose ) \
|
||||
mbedtls_printf( "passed\n" ); \
|
||||
@ -935,6 +935,7 @@ int mbedtls_aria_self_test( int verbose )
|
||||
int i;
|
||||
uint8_t blk[MBEDTLS_ARIA_BLOCKSIZE];
|
||||
mbedtls_aria_context ctx;
|
||||
int ret = 1;
|
||||
|
||||
#if (defined(MBEDTLS_CIPHER_MODE_CFB) || defined(MBEDTLS_CIPHER_MODE_CTR))
|
||||
size_t j;
|
||||
@ -946,6 +947,8 @@ int mbedtls_aria_self_test( int verbose )
|
||||
uint8_t buf[48], iv[MBEDTLS_ARIA_BLOCKSIZE];
|
||||
#endif
|
||||
|
||||
mbedtls_aria_init( &ctx );
|
||||
|
||||
/*
|
||||
* Test set 1
|
||||
*/
|
||||
@ -1065,7 +1068,11 @@ int mbedtls_aria_self_test( int verbose )
|
||||
mbedtls_printf( "\n" );
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||
|
||||
return( 0 );
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
mbedtls_aria_free( &ctx );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
@ -942,9 +942,11 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
unsigned char nonce_counter[16];
|
||||
unsigned char stream_block[16];
|
||||
#endif
|
||||
int ret = 1;
|
||||
|
||||
mbedtls_camellia_context ctx;
|
||||
|
||||
mbedtls_camellia_init( &ctx );
|
||||
memset( key, 0, 32 );
|
||||
|
||||
for( j = 0; j < 6; j++ ) {
|
||||
@ -974,8 +976,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
{
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "failed\n" );
|
||||
|
||||
return( 1 );
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1027,8 +1028,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
{
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "failed\n" );
|
||||
|
||||
return( 1 );
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1071,8 +1071,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
{
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "failed\n" );
|
||||
|
||||
return( 1 );
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1087,8 +1086,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
{
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "failed\n" );
|
||||
|
||||
return( 1 );
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1100,7 +1098,11 @@ int mbedtls_camellia_self_test( int verbose )
|
||||
mbedtls_printf( "\n" );
|
||||
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||
|
||||
return( 0 );
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
mbedtls_camellia_free( &ctx );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
Loading…
Reference in New Issue
Block a user