Fixes for entropy test suite for some configurations

Changes to allow the entropy tests to work for configurations without an
entropy seed file (MBEDTLS_ENTROPY_NV_SEED), and with no entropy sources
configured (MBEDTLS_TEST_NULL_ENTROPY).
This commit is contained in:
Simon Butcher 2016-09-15 18:42:26 +01:00
parent 8e3afc7332
commit b7f45c54a7
2 changed files with 10 additions and 5 deletions

View file

@ -53,4 +53,9 @@ Check NV seed manually #3
entropy_nv_seed:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
Entropy self test
entropy_selftest:
depends_on:!MBEDTLS_TEST_NULL_ENTROPY
entropy_selftest:0
Entropy self test (MBEDTLS_TEST_NULL_ENTROPY)
depends_on:MBEDTLS_TEST_NULL_ENTROPY
entropy_selftest:1

View file

@ -123,7 +123,7 @@ static int read_nv_seed( unsigned char *buf, size_t buf_len )
* END_DEPENDENCIES
*/
/* BEGIN_CASE depends_on:MBEDTLS_FS_IO */
/* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
void entropy_seed_file( char *path, int ret )
{
mbedtls_entropy_context ctx;
@ -210,7 +210,7 @@ void entropy_source_fail( char *path )
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
TEST_ASSERT( mbedtls_entropy_gather( &ctx )
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
#if defined(MBEDTLS_FS_IO)
#if defined(MBEDTLS_FS_IO) && defined(MBEDTLS_ENTROPY_NV_SEED)
TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, path )
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, path )
@ -378,8 +378,8 @@ void entropy_nv_seed( char *read_seed_str )
/* END_CASE */
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
void entropy_selftest( )
void entropy_selftest( int result )
{
TEST_ASSERT( mbedtls_entropy_self_test( 0 ) == 0 );
TEST_ASSERT( mbedtls_entropy_self_test( 0 ) == result );
}
/* END_CASE */