mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-24 17:42:58 +00:00
On OpenBSD, use arc4random_buf() instead of rand() to prevent warnings
This commit is contained in:
@@ -105,6 +105,7 @@ static 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 )
|
||||
{
|
||||
#if !defined(__OpenBSD__)
|
||||
size_t i;
|
||||
|
||||
if( rng_state != NULL )
|
||||
@@ -112,6 +113,12 @@ static int rnd_std_rand( void *rng_state, unsigned char *output, size_t len )
|
||||
|
||||
for( i = 0; i < len; ++i )
|
||||
output[i] = rand();
|
||||
#else
|
||||
if( rng_state != NULL )
|
||||
rng_state = NULL;
|
||||
|
||||
arc4random_buf( output, len );
|
||||
#endif /* !OpenBSD */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user