Files
haikuports/dev-libs/openssl/patches/openssl-1.1.1k.patchset
2021-04-01 12:03:41 +02:00

120 lines
3.5 KiB
Plaintext

From 20e8d7801a02b24db87f0675d1295418c55b8a5a 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/config b/config
index f28828d..2cf58af 100755
--- a/config
+++ b/config
@@ -912,7 +912,7 @@ fi
if $PERL $THERE/Configure LIST | grep "$OUT" > /dev/null; then
if [ "$VERBOSE" = "true" ]; then
- echo /usr/bin/env \
+ echo /bin/env \
__CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
__CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
__CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
@@ -925,7 +925,7 @@ if $PERL $THERE/Configure LIST | grep "$OUT" > /dev/null; then
if [ "$DRYRUN" = "false" ]; then
# eval to make sure quoted options, possibly with spaces inside,
# are treated right
- eval /usr/bin/env \
+ eval /bin/env \
__CNF_CPPDEFINES="'$__CNF_CPPDEFINES'" \
__CNF_CPPINCLUDES="'$__CNF_CPPINCLUDES'" \
__CNF_CPPFLAGS="'$__CNF_CPPFLAGS'" \
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index fe457ca..6389c6d 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -217,7 +217,9 @@ void rand_pool_keep_random_devices_open(int keep)
# if !defined(DEVRANDOM)
# error "OS seeding requires DEVRANDOM to be configured"
# endif
+#ifndef __HAIKU__
# define OPENSSL_RAND_SEED_GETRANDOM
+#endif
# define OPENSSL_RAND_SEED_DEVRANDOM
# endif
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index 6e7291a..7542308 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -56,7 +56,7 @@ DEFINE_LHASH_OF(MEM);
# 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
diff --git a/os-dep/haiku.h b/os-dep/haiku.h
index 7e908ef..7735f6d 100644
--- a/os-dep/haiku.h
+++ b/os-dep/haiku.h
@@ -1,2 +1,4 @@
#include <sys/select.h>
#include <sys/time.h>
+
+#define OPENSSL_NO_SECURE_MEMORY
--
2.28.0
From 23a019c8e82e73be8761a02b164053e605ae021f 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 bfa8d7d..69be76c 100644
--- a/crypto/x509/x509_def.c
+++ b/crypto/x509/x509_def.c
@@ -12,6 +12,10 @@
#include <openssl/crypto.h>
#include <openssl/x509.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
const char *X509_get_default_private_dir(void)
{
return X509_PRIVATE_DIR;
@@ -24,6 +28,20 @@ const char *X509_get_default_cert_area(void)
const char *X509_get_default_cert_dir(void)
{
+#ifdef __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;
+ }
+#endif
return X509_CERT_DIR;
}
--
2.28.0