Add a config flag for the global RNG

The global RNG should be provided by the application depending on
the RNG used there. (I.e. TRNG)
This commit is contained in:
Jarno Lamsa 2019-10-01 14:54:41 +03:00
parent 0736325d80
commit d82e559a48
2 changed files with 10 additions and 1 deletions

View File

@ -3683,6 +3683,14 @@
*/
//#define MBEDTLS_PLATFORM_GMTIME_R_ALT
/**
* Uncomment the macro to let Mbed TLS use a platform implementation of
* global RNG.
*
* By default the global RNG function will be a no-op.
*/
//#define MBEDTLS_PLATFORM_GLOBAL_RNG
/* \} name SECTION: Customisation configuration options */
/**

View File

@ -137,12 +137,13 @@ int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num )
return 1;
}
//TODO: This is a stub implementation of the global RNG function.
#if !defined(MBEDTLS_PLATFORM_GLOBAL_RNG)
size_t mbedtls_random_in_range( size_t num )
{
(void) num;
return 0;
}
#endif /* !MBEDTLS_PLATFORM_GLOBAL_RNG */
#if defined(MBEDTLS_HAVE_TIME_DATE) && !defined(MBEDTLS_PLATFORM_GMTIME_R_ALT)
#include <time.h>