Change the rng-function name

Change the name to mbedtls_platform_random_in_range
This commit is contained in:
Jarno Lamsa 2019-10-01 15:31:08 +03:00
parent 21d6a201ee
commit a19673222b
2 changed files with 7 additions and 7 deletions

View File

@ -170,7 +170,7 @@ void mbedtls_platform_memcpy( void *dst, const void *src, size_t num );
int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num ); int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num );
size_t mbedtls_random_in_range( size_t num ); size_t mbedtls_platform_random_in_range( size_t num );
#if defined(MBEDTLS_HAVE_TIME_DATE) #if defined(MBEDTLS_HAVE_TIME_DATE)
/** /**

View File

@ -82,9 +82,9 @@ void mbedtls_platform_zeroize( void *buf, size_t len )
void mbedtls_platform_memset( void *ptr, int value, size_t num ) void mbedtls_platform_memset( void *ptr, int value, size_t num )
{ {
/* Randomize start offset. */ /* Randomize start offset. */
size_t startOffset = mbedtls_random_in_range( num ); size_t startOffset = mbedtls_platform_random_in_range( num );
/* Randomize data */ /* Randomize data */
size_t data = mbedtls_random_in_range( 0xff ); size_t data = mbedtls_platform_random_in_range( 0xff );
/* Perform a pair of memset operations from random locations with /* Perform a pair of memset operations from random locations with
* random data */ * random data */
@ -99,9 +99,9 @@ void mbedtls_platform_memset( void *ptr, int value, size_t num )
void mbedtls_platform_memcpy( void *dst, const void *src, size_t num ) void mbedtls_platform_memcpy( void *dst, const void *src, size_t num )
{ {
/* Randomize start offset. */ /* Randomize start offset. */
size_t startOffset = mbedtls_random_in_range( num ); size_t startOffset = mbedtls_platform_random_in_range( num );
/* Randomize initial data to prevent leakage while copying */ /* Randomize initial data to prevent leakage while copying */
size_t data = mbedtls_random_in_range( 0xff ); size_t data = mbedtls_platform_random_in_range( 0xff );
memset( ( void * ) dst, data, num ); memset( ( void * ) dst, data, num );
memcpy( ( void * ) ( ( unsigned char * ) dst + startOffset ), memcpy( ( void * ) ( ( unsigned char * ) dst + startOffset ),
@ -116,7 +116,7 @@ int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num )
size_t i = num; size_t i = num;
size_t startOffset = mbedtls_random_in_range( num ); size_t startOffset = mbedtls_platform_random_in_range( num );
for( i = startOffset; i < num; i++ ) for( i = startOffset; i < num; i++ )
{ {
@ -139,7 +139,7 @@ int mbedtls_platform_memcmp( const void *buf1, const void *buf2, size_t num )
} }
#if !defined(MBEDTLS_PLATFORM_GLOBAL_RNG) #if !defined(MBEDTLS_PLATFORM_GLOBAL_RNG)
size_t mbedtls_random_in_range( size_t num ) size_t mbedtls_platform_random_in_range( size_t num )
{ {
(void) num; (void) num;
return 0; return 0;