Allow compilation without MBEDTLS_SELF_TEST enabled

This commit is contained in:
Paul Bakker 2016-07-14 14:30:45 +01:00 committed by Simon Butcher
parent 217efbcb4b
commit 70940caeeb

View file

@ -106,8 +106,8 @@ static int run_test_snprintf( void )
* self-test. If this fails, we attempt the test anyway, so no error is passed
* back.
*/
#if defined(MBEDTLS_ENTROPY_C) && defined(MBEDTLS_ENTROPY_NV_SEED) && \
!defined(MBEDTLS_NO_PLATFORM_ENTROPY)
#if defined(MBEDTLS_SELF_TEST) && defined(MBEDTLS_ENTROPY_C) && \
defined(MBEDTLS_ENTROPY_NV_SEED) && !defined(MBEDTLS_NO_PLATFORM_ENTROPY)
static void create_entropy_seed_file( void )
{
int result;
@ -138,7 +138,7 @@ static void create_entropy_seed_file( void )
int main( int argc, char *argv[] )
{
int v, suites_tested = 0, suites_failed = 0;
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_SELF_TEST)
unsigned char buf[1000000];
#endif
void *pointer;
@ -396,10 +396,6 @@ int main( int argc, char *argv[] )
suites_tested++;
#endif
#else
mbedtls_printf( " MBEDTLS_SELF_TEST not defined.\n" );
#endif
if( v != 0 )
{
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C) && defined(MBEDTLS_MEMORY_DEBUG)
@ -416,6 +412,10 @@ int main( int argc, char *argv[] )
suites_tested++;
#endif
#else
mbedtls_printf( " MBEDTLS_SELF_TEST not defined.\n" );
#endif
if( v != 0 )
{
mbedtls_printf( " Executed %d test suites\n\n", suites_tested );