mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Merge remote-tracking branch 'origin/development' into development_new
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com> Conflicts: include/mbedtls/check_config.h: nearby edits library/entropy.c: nearby edits programs/random/gen_random_havege.c: modification vs. removal programs/ssl/ssl_test_lib.h: nearby edits programs/test/cpp_dummy_build.cpp: nearby edits visualc/VS2010/mbedTLS.vcxproj: automatically generated file, regenerated with scripts/generate_visualc_files.pl
This commit is contained in:
@@ -134,6 +134,28 @@ int read_nv_seed( unsigned char *buf, size_t buf_len )
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void entropy_init_free( int reinit )
|
||||
{
|
||||
mbedtls_entropy_context ctx;
|
||||
|
||||
/* Double free is not explicitly documented to work, but it is convenient
|
||||
* to call mbedtls_entropy_free() unconditionally on an error path without
|
||||
* checking whether it has already been called in the success path. */
|
||||
|
||||
mbedtls_entropy_init( &ctx );
|
||||
mbedtls_entropy_free( &ctx );
|
||||
|
||||
if( reinit )
|
||||
mbedtls_entropy_init( &ctx );
|
||||
mbedtls_entropy_free( &ctx );
|
||||
|
||||
/* This test case always succeeds, functionally speaking. A plausible
|
||||
* bug might trigger an invalid pointer dereference or a memory leak. */
|
||||
goto exit;
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
|
||||
void entropy_seed_file( char * path, int ret )
|
||||
{
|
||||
@@ -149,6 +171,21 @@ exit:
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:MBEDTLS_ENTROPY_NV_SEED:MBEDTLS_FS_IO */
|
||||
void entropy_write_base_seed_file( int ret )
|
||||
{
|
||||
mbedtls_entropy_context ctx;
|
||||
|
||||
mbedtls_entropy_init( &ctx );
|
||||
|
||||
TEST_ASSERT( mbedtls_entropy_write_seed_file( &ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE ) == ret );
|
||||
TEST_ASSERT( mbedtls_entropy_update_seed_file( &ctx, MBEDTLS_PLATFORM_STD_NV_SEED_FILE ) == ret );
|
||||
|
||||
exit:
|
||||
mbedtls_entropy_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void entropy_no_sources( )
|
||||
{
|
||||
@@ -217,6 +254,9 @@ void entropy_func_len( int len, int ret )
|
||||
|
||||
for( j = len; j < sizeof( buf ); j++ )
|
||||
TEST_ASSERT( acc[j] == 0 );
|
||||
|
||||
exit:
|
||||
mbedtls_entropy_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user