1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Documentation and entropy self test changes (#610)

Ensure that the entropy self test always fails whenever
MBEDTLS_TEST_NULL_ENTROPY is defined. This is because the option is
meant to be for testing and development purposes rather than production
quality software. Also, this patch enhances the documentation for
mbedtls_entropy_source_self_test() and mbedtls_entropy_self_test().
This commit is contained in:
Andres Amaya Garcia
2016-09-13 13:30:02 +01:00
committed by Simon Butcher
parent c0d76b8255
commit a928e67278
2 changed files with 14 additions and 1 deletions

View File

@ -575,7 +575,7 @@ cleanup:
*/
int mbedtls_entropy_self_test( int verbose )
{
int ret = 0;
int ret = 1;
mbedtls_entropy_context ctx;
unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
unsigned char acc[MBEDTLS_ENTROPY_BLOCK_SIZE] = { 0 };
@ -584,6 +584,7 @@ int mbedtls_entropy_self_test( int verbose )
if( verbose != 0 )
mbedtls_printf( " ENTROPY test: " );
#if !defined(MBEDTLS_TEST_NULL_ENTROPY)
mbedtls_entropy_init( &ctx );
/* First do a gather to make sure we have default sources */
@ -631,6 +632,7 @@ int mbedtls_entropy_self_test( int verbose )
cleanup:
mbedtls_entropy_free( &ctx );
#endif /* !MBEDTLS_TEST_NULL_ENTROPY */
if( verbose != 0 )
{