Use arc4random_buf on macOS

macOS uses an AES based arc4random_buf implementation since at least
macOS 10.2.

Closes GH-6591.
This commit is contained in:
David CARLIER 2021-01-09 07:12:12 +00:00 committed by Nikita Popov
parent 973138f39d
commit 7a049cd6a4

View File

@ -94,7 +94,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
}
return FAILURE;
}
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001))
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001) || defined(__APPLE__))
arc4random_buf(bytes, size);
#else
size_t read_bytes = 0;