1
0
mirror of https://github.com/php/php-src.git synced 2026-04-25 17:08:14 +02:00

random: whitelist arc4random_buf if glibc

Glibc will soon implement the BSD arc4random API. whitelist its
implementation as safe.

Closes #8984.
This commit is contained in:
Cristian Rodríguez
2022-07-12 18:58:27 +00:00
committed by David Carlier
parent 2673c1dfa1
commit 3be9118662
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -32,6 +32,8 @@ PHP NEWS
. Fixed empty array returned by str_split on empty input. (Michael Vorisek)
. Added ini_parse_quantity function to convert ini quantities shorthand
notation to int. (Dennis Snell)
. Enable arc4random_buf for Linux glibc 2.36 and onwards
for the random_bytes. (Cristian Rodriguez)
07 Jul 2022, PHP 8.2.0alpha3
+1 -1
View File
@@ -94,7 +94,7 @@ PHPAPI int php_random_bytes(void *bytes, size_t size, bool should_throw)
}
return FAILURE;
}
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001) || defined(__APPLE__))
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001) || defined(__APPLE__) || defined(__GLIBC__))
arc4random_buf(bytes, size);
#else
size_t read_bytes = 0;