mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 23:05:38 +01:00
Change the rng-function name
Change the name to mbedtls_platform_random_in_range
This commit is contained in:
parent
21d6a201ee
commit
a19673222b
@ -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)
|
||||||
/**
|
/**
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user