CAMELLIA: add missing context init/free
This fixes the self-test with alternative implementations. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
be89fea1a7
commit
c537aa83f4
1 changed files with 11 additions and 9 deletions
|
@ -942,9 +942,11 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
unsigned char nonce_counter[16];
|
unsigned char nonce_counter[16];
|
||||||
unsigned char stream_block[16];
|
unsigned char stream_block[16];
|
||||||
#endif
|
#endif
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
mbedtls_camellia_context ctx;
|
mbedtls_camellia_context ctx;
|
||||||
|
|
||||||
|
mbedtls_camellia_init( &ctx );
|
||||||
memset( key, 0, 32 );
|
memset( key, 0, 32 );
|
||||||
|
|
||||||
for( j = 0; j < 6; j++ ) {
|
for( j = 0; j < 6; j++ ) {
|
||||||
|
@ -974,8 +976,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
{
|
{
|
||||||
if( verbose != 0 )
|
if( verbose != 0 )
|
||||||
mbedtls_printf( "failed\n" );
|
mbedtls_printf( "failed\n" );
|
||||||
|
goto exit;
|
||||||
return( 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1027,8 +1028,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
{
|
{
|
||||||
if( verbose != 0 )
|
if( verbose != 0 )
|
||||||
mbedtls_printf( "failed\n" );
|
mbedtls_printf( "failed\n" );
|
||||||
|
goto exit;
|
||||||
return( 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,8 +1071,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
{
|
{
|
||||||
if( verbose != 0 )
|
if( verbose != 0 )
|
||||||
mbedtls_printf( "failed\n" );
|
mbedtls_printf( "failed\n" );
|
||||||
|
goto exit;
|
||||||
return( 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1087,8 +1086,7 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
{
|
{
|
||||||
if( verbose != 0 )
|
if( verbose != 0 )
|
||||||
mbedtls_printf( "failed\n" );
|
mbedtls_printf( "failed\n" );
|
||||||
|
goto exit;
|
||||||
return( 1 );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1100,7 +1098,11 @@ int mbedtls_camellia_self_test( int verbose )
|
||||||
mbedtls_printf( "\n" );
|
mbedtls_printf( "\n" );
|
||||||
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
#endif /* MBEDTLS_CIPHER_MODE_CTR */
|
||||||
|
|
||||||
return( 0 );
|
ret = 0;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
mbedtls_camellia_free( &ctx );
|
||||||
|
return( ret );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_SELF_TEST */
|
#endif /* MBEDTLS_SELF_TEST */
|
||||||
|
|
Loading…
Reference in a new issue