Files
haikuports/dev-libs/openssl/patches/openssl3-3.5.0.patchset
Jérôme Duval 721d4d8a47 openssl3: fix x86_gcc2 build
don't build tests
fix conflicts
2025-04-09 22:45:23 +02:00

357 lines
11 KiB
Plaintext

From 93ad4221e2818a270fee7aa8e27ed87e6ff9d433 Mon Sep 17 00:00:00 2001
From: Augustin Cavalier <waddlesplash@gmail.com>
Date: Sat, 14 Mar 2020 19:20:45 -0400
Subject: Small changes for Haiku.
diff --git a/include/internal/common.h b/include/internal/common.h
index 0c0415b..1578908 100644
--- a/include/internal/common.h
+++ b/include/internal/common.h
@@ -83,7 +83,7 @@ __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
# ifndef OPENSSL_SYS_VMS
# define X509_CERT_AREA OPENSSLDIR
# define X509_CERT_DIR OPENSSLDIR "/certs"
-# define X509_CERT_FILE OPENSSLDIR "/cert.pem"
+# define X509_CERT_FILE OPENSSLDIR "/CARootCertificates.pem"
# define X509_PRIVATE_DIR OPENSSLDIR "/private"
# define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
# else
--
2.45.2
From 8e7b8c025c49ada55380f212670e8fbcc2f7e1ab Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 18 Nov 2020 18:29:38 +0100
Subject: Use find_directory to locate user certificates
We want this directory (where the user can easily add their own
certificates) to be non-packaged and under user control. The system
certificates are centralized in the CARootCertificates.pem file.
This was previously done in BSecureSocket (overriding OpenSSL defaults),
now it is valid also for apps using OpenSSL directly.
diff --git a/crypto/x509/x509_def.c b/crypto/x509/x509_def.c
index 7d5b642..92544ec 100644
--- a/crypto/x509/x509_def.c
+++ b/crypto/x509/x509_def.c
@@ -65,6 +65,10 @@ DEFINE_RUN_ONCE_STATIC(do_openssldir_setup)
}
#endif
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
const char *X509_get_default_private_dir(void)
{
#if defined (_WIN32)
@@ -87,7 +91,20 @@ const char *X509_get_default_cert_area(void)
const char *X509_get_default_cert_dir(void)
{
-#if defined (_WIN32)
+#if defined(__HAIKU__)
+ static char path[PATH_MAX];
+ if (path[0] != 0)
+ {
+ // We already called find_directory
+ return path;
+ }
+
+ if (find_directory(B_SYSTEM_NONPACKAGED_DATA_DIRECTORY, 0, false, path, sizeof(path)) == B_OK)
+ {
+ strlcat(path, "/ssl/certs/", sizeof(path));
+ return path;
+ }
+#elif defined (_WIN32)
RUN_ONCE(&openssldir_setup_init, do_openssldir_setup);
return x509_cert_dirptr;
#else
--
2.45.2
From bb52f649a0b46c25a29ef2dce9f13fd8a6cae2f2 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Wed, 13 Dec 2023 14:54:54 +0100
Subject: Haiku: skip test case test_print_error_format
diff --git a/test/errtest.c b/test/errtest.c
index 2a66b48..e608f4b 100644
--- a/test/errtest.c
+++ b/test/errtest.c
@@ -21,6 +21,12 @@
#endif
#ifndef OPENSSL_NO_DEPRECATED_3_0
+#ifdef __HAIKU__
+static int test_print_error_format(void)
+{
+ return TEST_skip("not supported on Haiku");
+}
+#else
# define IS_HEX(ch) ((ch >= '0' && ch <='9') || (ch >= 'A' && ch <='F'))
static int test_print_error_format(void)
@@ -112,6 +118,7 @@ err:
return ret;
}
#endif
+#endif
/* Test that querying the error queue preserves the OS error. */
static int preserves_system_error(void)
--
2.45.2
From 23eeed9dff9eabdf1b1198d2d3de2b1fd3e227a7 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Wed, 13 Dec 2023 14:59:20 +0100
Subject: Haiku: don't use IPV6_V6ONLY
diff --git a/crypto/bio/bio_sock2.c b/crypto/bio/bio_sock2.c
index 252a9ab..eb389f0 100644
--- a/crypto/bio/bio_sock2.c
+++ b/crypto/bio/bio_sock2.c
@@ -328,7 +328,8 @@ int BIO_listen(int sock, const BIO_ADDR *addr, int options)
}
/* On OpenBSD it is always IPv6 only with IPv6 sockets thus read-only */
-# if defined(IPV6_V6ONLY) && !defined(__OpenBSD__)
+ /* IPV6_V6ONLY is broken on Haiku */
+# if defined(IPV6_V6ONLY) && !defined(__OpenBSD__) && !defined(__HAIKU__)
if (BIO_ADDR_family(addr) == AF_INET6) {
/*
* Note: Windows default of IPV6_V6ONLY is ON, and Linux is OFF.
--
2.45.2
From 7352e134f1b0c8986a35155a1735b4c3a105ac65 Mon Sep 17 00:00:00 2001
From: David Karoly <david.karoly@outlook.com>
Date: Wed, 13 Dec 2023 17:49:28 +0100
Subject: Haiku: listening sockets shall default to IPv4
diff --git a/crypto/bio/bss_acpt.c b/crypto/bio/bss_acpt.c
index 24423aa..4696a89 100644
--- a/crypto/bio/bss_acpt.c
+++ b/crypto/bio/bss_acpt.c
@@ -94,7 +94,13 @@ static BIO_ACCEPT *BIO_ACCEPT_new(void)
if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
return NULL;
+
+#ifdef __HAIKU__
+ ret->accept_family = BIO_FAMILY_IPV4;
+#else
ret->accept_family = BIO_FAMILY_IPANY;
+#endif
+
ret->accept_sock = (int)INVALID_SOCKET;
return ret;
}
--
2.45.2
From 889c4fcae4700b6ece08e775cc5f46b4c7770ab5 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 4 Jun 2024 21:35:22 +0200
Subject: Haiku: inherit unix, add symbol versioning
diff --git a/Configurations/50-haiku.conf b/Configurations/50-haiku.conf
index 4580e71..c8c2805 100644
--- a/Configurations/50-haiku.conf
+++ b/Configurations/50-haiku.conf
@@ -1,35 +1,31 @@
my %targets = (
"haiku-common" => {
+ inherit_from => [ "BASE_unix" ],
template => 1,
- CC => "cc",
CFLAGS => add_before(picker(default => "-Wall",
debug => "-g -O0",
release => "-O2")),
cflags => add_before("-DL_ENDIAN -include \$(SRCDIR)/os-dep/haiku.h",
threads("-D_REENTRANT")),
- AR => "ar",
- ARFLAGS => "qc",
HASHBANGPERL => "/bin/env perl",
sys_id => "HAIKU",
- ex_libs => "-lnetwork",
+ ex_libs => add("-lnetwork"),
perlasm_scheme => "elf",
thread_scheme => "pthreads",
dso_scheme => "dlfcn",
- shared_target => "gnu-shared",
+ shared_target => "haiku-shared",
shared_cflag => "-fPIC",
- shared_ldflag => "-shared",
- perl_platform => 'Unix',
+ shared_ldflag => add_before("-shared"),
},
"haiku-x86" => {
inherit_from => [ "haiku-common" ],
- CFLAGS => add(picker(release => "-fomit-frame-pointer")),
bn_ops => "BN_LLONG",
asm_arch => 'x86',
perlasm_scheme => 'elf',
},
"haiku-x86_64" => {
inherit_from => [ "haiku-common" ],
- cflags => add("-m64"),
bn_ops => "SIXTY_FOUR_BIT_LONG",
+ asm_arch => 'x86_64',
},
);
diff --git a/Configurations/shared-info.pl b/Configurations/shared-info.pl
index caf6f90..96953f9 100644
--- a/Configurations/shared-info.pl
+++ b/Configurations/shared-info.pl
@@ -40,6 +40,7 @@ my %shared_info;
};
},
'bsd-gcc-shared' => sub { return $shared_info{'linux-shared'}; },
+ 'haiku-shared' => sub { return $shared_info{'linux-shared'}; },
'bsd-gcc-nodef-shared' => sub {
return {
%{$shared_info{'gnu-shared'}},
diff --git a/util/mkdef.pl b/util/mkdef.pl
index 309f908..14e5854 100755
--- a/util/mkdef.pl
+++ b/util/mkdef.pl
@@ -114,6 +114,7 @@ my %OS_data = (
"solaris-gcc" => 'solaris', # alias
linux => 'solaris', # alias
"bsd-gcc" => 'solaris', # alias
+ "haiku" => 'solaris', # alias
aix => { writer => \&writer_aix,
sort => sorter_unix(),
platforms => { UNIX => 1 } },
diff --git a/util/shlib_wrap.sh.in b/util/shlib_wrap.sh.in
index 675d99a..5d9b667 100755
--- a/util/shlib_wrap.sh.in
+++ b/util/shlib_wrap.sh.in
@@ -97,7 +97,9 @@ NONSTOP_KERNEL)
DYLD_LIBRARY_PATH="${THERE}:$DYLD_LIBRARY_PATH" # MacOS X
SHLIB_PATH="${THERE}:$SHLIB_PATH" # legacy HP-UX
LIBPATH="${THERE}:$LIBPATH" # AIX, OS/2
+ LIBRARY_PATH="${THERE}:$LIBRARY_PATH" # Haiku
export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH
+ export LIBRARY_PATH
# Even though $PATH is adjusted [for Windows sake], it doesn't
# necessarily does the trick. Trouble is that with introduction
# of SafeDllSearchMode in XP/2003 it's more appropriate to copy
--
2.45.2
From d8a977df1051e212eadf9284b7ae8b24dc550348 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Date: Wed, 8 Jun 2022 20:45:32 +0200
Subject: Remove the provider section.
The provider section breaks libssl1.1 users. Remove it for now.
Link: https://bugs.debian.org/1011051
Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
diff --git a/apps/openssl.cnf b/apps/openssl.cnf
index abace0e..c1a142f 100644
--- a/apps/openssl.cnf
+++ b/apps/openssl.cnf
@@ -51,11 +51,11 @@ tsa_policy3 = 1.2.3.4.5.7
# .include fipsmodule.cnf
[openssl_init]
-providers = provider_sect
+# providers = provider_sect
# List of providers to load
-[provider_sect]
-default = default_sect
+# [provider_sect]
+# default = default_sect
# The fips section name should match the section name inside the
# included fipsmodule.cnf.
# fips = fips_sect
@@ -68,7 +68,7 @@ default = default_sect
# becomes unavailable in openssl. As a consequence applications depending on
# OpenSSL may not work correctly which could lead to significant system
# problems including inability to remotely access the system.
-[default_sect]
+# [default_sect]
# activate = 1
--
2.45.2
From 236d446a926fecb28d49c5a2ad21fdd3e848e3ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= <jerome.duval@gmail.com>
Date: Sun, 16 Mar 2025 19:50:17 +0100
Subject: gnu-shared: remove Bsymbolic like Debian
diff --git a/Configurations/shared-info.pl b/Configurations/shared-info.pl
index 96953f9..b4437c2 100644
--- a/Configurations/shared-info.pl
+++ b/Configurations/shared-info.pl
@@ -25,7 +25,7 @@ sub detect_gnu_cc {
my %shared_info;
%shared_info = (
'gnu-shared' => {
- shared_ldflag => '-shared -Wl,-Bsymbolic',
+ shared_ldflag => '-shared',
shared_sonameflag => '-Wl,-soname=',
},
'linux-shared' => sub {
--
2.45.2
From 5599155088b7b8353d92b922eb780681e7fd86c6 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 9 Apr 2025 20:00:11 +0200
Subject: fix gcc2 build
diff --git a/crypto/hashtable/hashtable.c b/crypto/hashtable/hashtable.c
index 74b4ec9..3ca8ad0 100644
--- a/crypto/hashtable/hashtable.c
+++ b/crypto/hashtable/hashtable.c
@@ -79,7 +79,7 @@
* cache line it is advantageous, when supported to fetch the entire
* structure for faster lookups
*/
-#if defined(__GNUC__) || defined(__CLANG__)
+#if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__CLANG__)
# define PREFETCH_NEIGHBORHOOD(x) __builtin_prefetch(x.entries)
# define PREFETCH(x) __builtin_prefetch(x)
#else
diff --git a/include/internal/common.h b/include/internal/common.h
index 1578908..c45c0e9 100644
--- a/include/internal/common.h
+++ b/include/internal/common.h
@@ -18,7 +18,7 @@
# include "internal/e_os.h" /* ossl_inline in many files */
# include "internal/nelem.h"
-# if defined(__GNUC__) || defined(__clang__)
+# if (defined(__GNUC__) && __GNUC__ >= 3) || defined(__clang__)
# define ossl_likely(x) __builtin_expect(!!(x), 1)
# define ossl_unlikely(x) __builtin_expect(!!(x), 0)
# else
--
2.45.2