return 0;
}
-#ifndef _EVENT_HAVE_ARC4RANDOM_BUF
static void
-arc4random_buf(void *buf, size_t n)
+ev_arc4random_buf(void *buf, size_t n)
{
+#ifdef _EVENT_HAVE_ARC4RANDOM_BUF
+ return arc4random_buf(buf, n);
+#else
unsigned char *b = buf;
/* Make sure that we start out with b at a 4-byte alignment; plenty
* of CPUs care about this for 32-bit access. */
ev_uint32_t u = arc4random();
memcpy(b, &u, n);
}
-}
#endif
+}
#else /* !_EVENT_HAVE_ARC4RANDOM { */
return val;
}
+static void
+ev_arc4random_buf(void *buf, size_t n)
+{
+ arc4random_buf(buf, n);
+}
+
#endif /* } !_EVENT_HAVE_ARC4RANDOM */
void
evutil_secure_rng_get_bytes(void *buf, size_t n)
{
- arc4random_buf(buf, n);
+ ev_arc4random_buf(buf, n);
}
void