Skip to content

Commit 7a049cd

Browse files
devnexennikic
authored andcommitted
Use arc4random_buf on macOS
macOS uses an AES based arc4random_buf implementation since at least macOS 10.2. Closes GH-6591.
1 parent 973138f commit 7a049cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/standard/random.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, zend_bool should_throw)
9494
}
9595
return FAILURE;
9696
}
97-
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001))
97+
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001) || defined(__APPLE__))
9898
arc4random_buf(bytes, size);
9999
#else
100100
size_t read_bytes = 0;

0 commit comments

Comments
 (0)