mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-08 21:00:05 +02:00
expat: switch to getentropy
This commit is contained in:
@@ -6,7 +6,7 @@ HOMEPAGE="http://expat.sourceforge.net/"
|
||||
COPYRIGHT="1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||
2001-2025 Expat maintainers."
|
||||
LICENSE="MIT"
|
||||
REVISION="1"
|
||||
REVISION="2"
|
||||
SOURCE_URI="https://downloads.sourceforge.net/expat/expat-$portVersion.tar.bz2"
|
||||
#SOURCE_URI="git+https://github.com/libexpat/libexpat?signed#tag=R_${portVersion//./_}"
|
||||
CHECKSUM_SHA256="e6af11b01e32e5ef64906a5cca8809eabc4beb7ff2f9a0e6aabbd42e825135d0"
|
||||
@@ -66,7 +66,7 @@ defineDebugInfoPackage expat$secondaryArchSuffix "${debugList[@]}"
|
||||
BUILD()
|
||||
{
|
||||
./buildconf.sh
|
||||
runConfigure ./configure --disable-static
|
||||
runConfigure ./configure --disable-static --with-getentropy
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
From 6a247234a78e6bb5d2685457043fae610415d2b2 Mon Sep 17 00:00:00 2001
|
||||
From 044c28bac274c97f870bffa5d09ba6d80f2c0945 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
|
||||
Date: Sat, 2 Dec 2023 02:02:15 +0100
|
||||
Subject: Fix INTERFACE_INCLUDE_DIRECTORIES on Haiku
|
||||
@@ -68,7 +68,7 @@ index 71fe499..d25195d 100644
|
||||
2.51.0
|
||||
|
||||
|
||||
From 417621cbc6239a61a4f79d4ee15c0431b6cb11df Mon Sep 17 00:00:00 2001
|
||||
From 1aad0157bdcb8e94f9b6673f2f555e6fb1a9a024 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Wed, 7 Feb 2024 18:47:27 +0100
|
||||
Subject: can't allocate so much on Haiku
|
||||
@@ -102,24 +102,87 @@ index b76cc45..67dd17e 100644
|
||||
2.51.0
|
||||
|
||||
|
||||
From e108afcce3ea84156f3f2ff17d3b34fb3301621b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
|
||||
Date: Mon, 2 Feb 2026 18:25:03 +0100
|
||||
Subject: Haiku: link against libbsd for arc4random_buf
|
||||
From e0e82a2778bcf7de6c1619ff5454ed4eb0a349cd Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Duval <jerome.duval@gmail.com>
|
||||
Date: Wed, 7 Feb 2024 18:47:27 +0100
|
||||
Subject: support for getentropy on Haiku
|
||||
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index d25195d..179167f 100644
|
||||
index d25195d..ae13670 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -216,6 +216,7 @@ AM_CONDITIONAL([_INTERNAL_LARGE_SIZE], [echo -- "${CPPFLAGS}${CFLAGS}" | ${FGREP
|
||||
@@ -290,6 +290,19 @@ AS_IF([test "x$with_sys_getrandom" != xno],
|
||||
AS_IF([test "x$with_sys_getrandom" = xyes],
|
||||
[AC_MSG_ERROR([enforced the use of syscall SYS_getrandom --with-sys-getrandom, but not detected])])])])
|
||||
|
||||
LT_LIB_M
|
||||
+AC_ARG_WITH([getentropy],
|
||||
+ [AS_HELP_STRING([--with-getentropy],
|
||||
+ [enforce the use of getentropy function in the system @<:@default=check@:>@])
|
||||
+AS_HELP_STRING([--without-getentropy],
|
||||
+ [skip auto detect of getentropy @<:@default=check@:>@])],
|
||||
+ [],
|
||||
+ [with_getentropy=check])
|
||||
+
|
||||
+AS_IF([test "x$with_getentropy" != xno],
|
||||
+ [AC_CHECK_FUNCS([getentropy],,
|
||||
+ [AS_IF([test "x$with_getentropy" = xyes],
|
||||
+ [AC_MSG_ERROR([enforced the use of getentropy --with-getentropy, but not detected])])])])
|
||||
+
|
||||
dnl Only needed for xmlwf:
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h)
|
||||
AC_TYPE_OFF_T
|
||||
diff --git a/lib/xmlparse.c b/lib/xmlparse.c
|
||||
index 086fca5..9fffc88 100644
|
||||
--- a/lib/xmlparse.c
|
||||
+++ b/lib/xmlparse.c
|
||||
@@ -143,8 +143,8 @@
|
||||
|
||||
+AC_CHECK_LIB([bsd], [arc4random_buf])
|
||||
AC_MSG_CHECKING([for arc4random_buf (BSD or glibc 2.36+)])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([
|
||||
#include <stdlib.h>
|
||||
#if ! defined(HAVE_GETRANDOM) && ! defined(HAVE_SYSCALL_GETRANDOM) \
|
||||
&& ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) \
|
||||
- && ! defined(XML_DEV_URANDOM) && ! defined(_WIN32) \
|
||||
- && ! defined(XML_POOR_ENTROPY)
|
||||
+ && ! defined(HAVE_GETENTROPY) && ! defined(XML_DEV_URANDOM) \
|
||||
+ && ! defined(_WIN32) && ! defined(XML_POOR_ENTROPY)
|
||||
# error You do not have support for any sources of high quality entropy \
|
||||
enabled. For end user security, that is probably not what you want. \
|
||||
\
|
||||
@@ -153,6 +153,7 @@
|
||||
* Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, \
|
||||
* BSD / macOS >=10.7 / glibc >=2.36 (arc4random_buf): HAVE_ARC4RANDOM_BUF, \
|
||||
* BSD / macOS (including <10.7) / glibc >=2.36 (arc4random): HAVE_ARC4RANDOM, \
|
||||
+ * POSIX 2024 (getentropy): HAVE_GETENTROPY, \
|
||||
* Linux (including <3.17) / BSD / macOS (including <10.7) / Solaris >=8 (/dev/urandom): XML_DEV_URANDOM, \
|
||||
* Windows >=Vista (rand_s): _WIN32. \
|
||||
\
|
||||
@@ -1035,7 +1036,7 @@ static const XML_Char implicitContext[]
|
||||
'\0'};
|
||||
|
||||
/* To avoid warnings about unused functions: */
|
||||
-#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM)
|
||||
+#if ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) && ! defined(HAVE_GETENTROPY)
|
||||
|
||||
# if defined(HAVE_GETRANDOM) || defined(HAVE_SYSCALL_GETRANDOM)
|
||||
|
||||
@@ -1104,7 +1105,7 @@ writeRandomBytes_dev_urandom(void *target, size_t count) {
|
||||
|
||||
# endif /* ! defined(_WIN32) && defined(XML_DEV_URANDOM) */
|
||||
|
||||
-#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */
|
||||
+#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) && ! defined(HAVE_GETENTROPY) */
|
||||
|
||||
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)
|
||||
|
||||
@@ -1208,6 +1209,9 @@ generate_hash_secret_salt(XML_Parser parser) {
|
||||
#if defined(HAVE_ARC4RANDOM_BUF)
|
||||
arc4random_buf(&entropy, sizeof(entropy));
|
||||
return ENTROPY_DEBUG("arc4random_buf", entropy);
|
||||
+#elif defined(HAVE_GETENTROPY)
|
||||
+ getentropy(&entropy, sizeof(entropy));
|
||||
+ return ENTROPY_DEBUG("getentropy", entropy);
|
||||
#elif defined(HAVE_ARC4RANDOM)
|
||||
writeRandomBytes_arc4random((void *)&entropy, sizeof(entropy));
|
||||
return ENTROPY_DEBUG("arc4random", entropy);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user