mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-21 03:37:49 +00:00
On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings
This commit is contained in:
parent
ccebf6ef8a
commit
95a11f8c16
|
@ -52,6 +52,7 @@ Bugfix
|
||||||
* Improve interoperability by not writing extension length in ClientHello
|
* Improve interoperability by not writing extension length in ClientHello
|
||||||
when no extensions are present (found by Matthew Page)
|
when no extensions are present (found by Matthew Page)
|
||||||
* rsa_check_pubkey() now allows an E up to N
|
* rsa_check_pubkey() now allows an E up to N
|
||||||
|
* On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings
|
||||||
|
|
||||||
= Version 1.2.10 released 2013-10-07
|
= Version 1.2.10 released 2013-10-07
|
||||||
Changes
|
Changes
|
||||||
|
|
|
@ -1408,6 +1408,7 @@ void rsa_free( rsa_context *ctx )
|
||||||
|
|
||||||
static int myrand( void *rng_state, unsigned char *output, size_t len )
|
static int myrand( void *rng_state, unsigned char *output, size_t len )
|
||||||
{
|
{
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if( rng_state != NULL )
|
if( rng_state != NULL )
|
||||||
|
@ -1415,6 +1416,12 @@ static int myrand( void *rng_state, unsigned char *output, size_t len )
|
||||||
|
|
||||||
for( i = 0; i < len; ++i )
|
for( i = 0; i < len; ++i )
|
||||||
output[i] = rand();
|
output[i] = rand();
|
||||||
|
#else
|
||||||
|
if( rng_state != NULL )
|
||||||
|
rng_state = NULL;
|
||||||
|
|
||||||
|
arc4random_buf( output, len );
|
||||||
|
#endif /* !OpenBSD */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ void hexify(unsigned char *obuf, const unsigned char *ibuf, int len)
|
||||||
*/
|
*/
|
||||||
static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||||
{
|
{
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if( rng_state != NULL )
|
if( rng_state != NULL )
|
||||||
|
@ -104,6 +105,12 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||||
|
|
||||||
for( i = 0; i < len; ++i )
|
for( i = 0; i < len; ++i )
|
||||||
output[i] = rand();
|
output[i] = rand();
|
||||||
|
#else
|
||||||
|
if( rng_state != NULL )
|
||||||
|
rng_state = NULL;
|
||||||
|
|
||||||
|
arc4random_buf( output, len );
|
||||||
|
#endif /* !OpenBSD */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue