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:
parent
8e3afc7332
commit
b7f45c54a7
@ -53,4 +53,9 @@ Check NV seed manually #3
|
|||||||
entropy_nv_seed:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
entropy_nv_seed:"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
||||||
|
|
||||||
Entropy self test
|
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
|
||||||
|
@ -123,7 +123,7 @@ static int read_nv_seed( unsigned char *buf, size_t buf_len )
|
|||||||
* END_DEPENDENCIES
|
* 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 )
|
void entropy_seed_file( char *path, int ret )
|
||||||
{
|
{
|
||||||
mbedtls_entropy_context ctx;
|
mbedtls_entropy_context ctx;
|
||||||
@ -210,7 +210,7 @@ void entropy_source_fail( char *path )
|
|||||||
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
||||||
TEST_ASSERT( mbedtls_entropy_gather( &ctx )
|
TEST_ASSERT( mbedtls_entropy_gather( &ctx )
|
||||||
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
== 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 )
|
TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, path )
|
||||||
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
== MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
|
||||||
TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, path )
|
TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, path )
|
||||||
@ -378,8 +378,8 @@ void entropy_nv_seed( char *read_seed_str )
|
|||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE depends_on:MBEDTLS_SELF_TEST */
|
/* 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 */
|
/* END_CASE */
|
||||||
|
Loading…
Reference in New Issue
Block a user