Skip to content

Commit

Permalink
Use arc4random_buf on macOS
Browse files Browse the repository at this point in the history
macOS uses an AES based arc4random_buf implementation since at least
macOS 10.2.

Closes GH-6591.
  • Loading branch information
devnexen authored and nikic committed Jan 12, 2021
1 parent 973138f commit 7a049cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/standard/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7a049cd

Please sign in to comment.