1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Rename HAVE_DECL_ARC4RANDOM_BUF to HAVE_ARC4RANDOM_BUF (#14565)

AC_CHECK_DECLS defines HAVE_DECL_ARC4RANDOM_BUF to 0 or 1. On Windows
this isn't defined to 0. To avoid the undefined state, the AC_CHECK_DECL
is used to manually define the HAVE_ARC4RANDOM_BUF to 1 if declaration
is found, otherwise undefined.

In the future on current platforms, also AC_CHECK_FUNCS can be used
instead since the arc4random_buf is located in default libraries (C)
with declaration available in headers.
This commit is contained in:
Peter Kokot
2024-06-13 22:36:05 +02:00
committed by GitHub
parent 37488d6e01
commit 3b951e7b04
2 changed files with 4 additions and 5 deletions

View File

@@ -1,7 +1,6 @@
dnl
dnl Check for arc4random on BSD systems
dnl
AC_CHECK_DECLS([arc4random_buf])
AC_CHECK_DECL([arc4random_buf],
[AC_DEFINE([HAVE_ARC4RANDOM_BUF], [1],
[Define to 1 if you have the 'arc4random_buf' function.])])
dnl
dnl Check for CCRandomGenerateBytes

View File

@@ -85,7 +85,7 @@ ZEND_ATTRIBUTE_NONNULL PHPAPI zend_result php_random_bytes_ex(void *bytes, size_
snprintf(errstr, errstr_size, "Failed to retrieve randomness from the operating system (CCRandomGenerateBytes)");
return FAILURE;
}
#elif HAVE_DECL_ARC4RANDOM_BUF && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001 && __NetBSD_Version__ < 1000000000) || \
#elif defined(HAVE_ARC4RANDOM_BUF) && ((defined(__OpenBSD__) && OpenBSD >= 201405) || (defined(__NetBSD__) && __NetBSD_Version__ >= 700000001 && __NetBSD_Version__ < 1000000000) || \
defined(__APPLE__))
/*
* OpenBSD until there is a valid equivalent