Merge branch 'PHP-8.3'

This commit is contained in:
David Carlier 2024-08-13 20:57:21 +01:00
commit 445ea01edf
No known key found for this signature in database
GPG key ID: D308BD11AB42D054
2 changed files with 7 additions and 2 deletions

View file

@ -12,6 +12,11 @@ AC_CHECK_HEADERS([CommonCrypto/CommonRandom.h],,, [dnl
#include <CommonCrypto/CommonCryptoError.h>
])
dnl
dnl Mostly for non Linux systems
dnl
AC_CHECK_FUNCS([getrandom])
dnl
dnl Setup extension
dnl

View file

@ -48,7 +48,7 @@
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h>
# if (defined(__FreeBSD__) && __FreeBSD_version > 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
(defined(__sun) && defined(HAVE_GETRANDOM)) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
# include <sys/random.h>
# endif
#endif
@ -100,7 +100,7 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI zend_result php_random_bytes_ex(void *bytes, size_
#else
size_t read_bytes = 0;
# if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
(defined(__sun) && defined(HAVE_GETRANDOM)) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
/* Linux getrandom(2) syscall or FreeBSD/DragonFlyBSD/NetBSD getrandom(2) function
* Being a syscall, implemented in the kernel, getrandom offers higher quality output
* compared to the arc4random api albeit a fallback to /dev/urandom is considered.