diff --git a/include/mbedtls/config.h b/include/mbedtls/config.h index 1a057a4af..965efffcb 100644 --- a/include/mbedtls/config.h +++ b/include/mbedtls/config.h @@ -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 */ /** diff --git a/library/platform_util.c b/library/platform_util.c index 73759cdb1..a5ece50fc 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -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