Removed arc4random_buf shim.

This commit is contained in:
Nathan Moinvaziri 2017-12-03 23:07:38 -08:00 committed by GitHub
parent 0574424b05
commit 6c6700d2f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,9 +21,7 @@
# include <unistd.h>
# include <utime.h>
#endif
#if defined __APPLE__ && defined __MACH__
# include <AvailabilityMacros.h>
#elif defined __linux__
#if defined __linux__
# include <bsd/stdlib.h>
#else
# include <stdlib.h>
@ -36,22 +34,6 @@
/***************************************************************************/
#if defined __APPLE__ && defined __MACH__ && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
static __inline__ int32_t arc4random_buf(uint8_t *buf, size_t nbytes)
{
for (; nbytes > 2; nbytes -= 3, buf += 3) {
uint32_t val = arc4random();
buf[0] = (val ) & 0xFF;
buf[1] = (val >> 8) & 0xFF;
buf[2] = (val >> 16) & 0xFF;
}
for (; nbytes > 0; nbytes--, buf++) {
*buf = arc4random() & 0xFF;
}
return nbytes;
}
#endif
int32_t mz_posix_rand(uint8_t *buf, int32_t size)
{
arc4random_buf(buf, size);