X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/9f8f8b1e1d553774865f2c177191c359c3dc652c..d6e398f9c:/sbr/m_rand.c?ds=inline diff --git a/sbr/m_rand.c b/sbr/m_rand.c index 4d248886..8544cfb2 100644 --- a/sbr/m_rand.c +++ b/sbr/m_rand.c @@ -6,16 +6,21 @@ * complete copyright information. */ -#include /* for abs(), srand(), rand() */ +#include /* for abs(), srand(), rand(), arc4random() */ #include /* for fopen(), fread(), fclose() */ #include /* for getpid() */ #include /* for time() */ +#include + +#if !HAVE_ARC4RANDOM static int seeded = 0; +#endif int m_rand (unsigned char *buf, size_t n) { +#if !HAVE_ARC4RANDOM if (! seeded) { FILE *devurandom; unsigned int seed; @@ -46,6 +51,9 @@ m_rand (unsigned char *buf, size_t n) { *buf++ = *rndp++; } } +#else + arc4random_buf(buf, n); +#endif return 0; }