Skip to content

Commit 445ea01

Browse files
committed
Merge branch 'PHP-8.3'
2 parents bf1b0eb + f1e5c63 commit 445ea01

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ext/random/config.m4

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ AC_CHECK_HEADERS([CommonCrypto/CommonRandom.h],,, [dnl
1212
#include <CommonCrypto/CommonCryptoError.h>
1313
])
1414

15+
dnl
16+
dnl Mostly for non Linux systems
17+
dnl
18+
AC_CHECK_FUNCS([getrandom])
19+
1520
dnl
1621
dnl Setup extension
1722
dnl

ext/random/csprng.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
#ifdef HAVE_SYS_PARAM_H
4949
# include <sys/param.h>
5050
# if (defined(__FreeBSD__) && __FreeBSD_version > 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \
51-
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
51+
(defined(__sun) && defined(HAVE_GETRANDOM)) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
5252
# include <sys/random.h>
5353
# endif
5454
#endif
@@ -100,7 +100,7 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI zend_result php_random_bytes_ex(void *bytes, size_
100100
#else
101101
size_t read_bytes = 0;
102102
# if (defined(__linux__) && defined(SYS_getrandom)) || (defined(__FreeBSD__) && __FreeBSD_version >= 1200000) || (defined(__DragonFly__) && __DragonFly_version >= 500700) || \
103-
defined(__sun) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
103+
(defined(__sun) && defined(HAVE_GETRANDOM)) || (defined(__NetBSD__) && __NetBSD_Version__ >= 1000000000) || defined(__midipix__)
104104
/* Linux getrandom(2) syscall or FreeBSD/DragonFlyBSD/NetBSD getrandom(2) function
105105
* Being a syscall, implemented in the kernel, getrandom offers higher quality output
106106
* compared to the arc4random api albeit a fallback to /dev/urandom is considered.

0 commit comments

Comments
 (0)