openssl: fix threading support

This commit is contained in:
Adrien Destugues
2017-11-23 00:22:48 +01:00
parent 993ffdf983
commit 6cbacb8e73

View File

@@ -1,11 +1,11 @@
From ebe71871447f0112adf84943c2e1e48c32343c77 Mon Sep 17 00:00:00 2001
From 62b20bd7b98e37f053f7d1383bc74dfd95ba4ab4 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 18 Jun 2014 02:37:21 +0000
Subject: Haiku: build fixes
diff --git a/Configure b/Configure
index 5da7cad..a366e88 100755
index fd7988e..9796a6e 100755
--- a/Configure
+++ b/Configure
@@ -508,6 +508,10 @@ my %table=(
@@ -39,7 +39,7 @@ index e8d222a..2216c8b 100644
link_a.bsd-shared: link_a.bsd
link_app.bsd-shared: link_app.bsd
diff --git a/config b/config
index bba370c..d4d0620 100755
index 21534e0..be8a6c6 100755
--- a/config
+++ b/config
@@ -134,6 +134,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
@@ -57,7 +57,7 @@ index bba370c..d4d0620 100755
HI-UX:*)
echo "${MACHINE}-hi-hiux"; exit 0
;;
@@ -848,6 +856,9 @@ case "$GUESSOS" in
@@ -857,6 +865,9 @@ case "$GUESSOS" in
options="$options no-asm"
fi
;;
@@ -71,7 +71,7 @@ index bba370c..d4d0620 100755
2.7.0
From 56aa0cc3ac136c72309364f6e723a61b1dac1462 Mon Sep 17 00:00:00 2001
From f86a8b62f11907b2c8a34fe141fc2d988d5cc881 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 18 Jun 2014 02:39:12 +0000
Subject: Haiku: Modify default Root CA filename
@@ -94,7 +94,7 @@ index fba180a..40c32df 100644
2.7.0
From 9992048c0a9ef4a1fefdff9981a553c0a2130bc2 Mon Sep 17 00:00:00 2001
From a7bc0feb95b4b05abb07b78ff92d1b2e893b204f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 9 Nov 2015 19:44:10 +0100
Subject: Do not use __INTEL__ to detect x86_64.
@@ -102,7 +102,7 @@ Subject: Do not use __INTEL__ to detect x86_64.
* Haiku defines it for 32-bit x86 as well.
diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c
index 6dfd590..bc571e5 100644
index b25fc6d..3bb0319 100644
--- a/crypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/crypto/evp/e_aes_cbc_hmac_sha1.c
@@ -92,8 +92,7 @@ typedef struct {
@@ -119,14 +119,14 @@ index 6dfd590..bc571e5 100644
2.7.0
From f3b305a87bf7d6c514190f23545d4df20c07c016 Mon Sep 17 00:00:00 2001
From 9b3a6933f35163fda6693f2400a072f63c8e4659 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 9 Nov 2015 20:32:09 +0100
Subject: more __intel__ fixes...
diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c
index 46c9d03..4a9ad27 100644
index 9a8a2ad..e984990 100644
--- a/crypto/evp/e_aes_cbc_hmac_sha256.c
+++ b/crypto/evp/e_aes_cbc_hmac_sha256.c
@@ -92,8 +92,7 @@ typedef struct {
@@ -154,7 +154,7 @@ index 93cfe3f..dc3937f 100644
# define STITCHED_CALL
# endif
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 6ece87d..1e569bb 100644
index 04212c5..54740e1 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -125,8 +125,7 @@
@@ -170,3 +170,37 @@ index 6ece87d..1e569bb 100644
--
2.7.0
From ddf022a852eceb03a21aab0982a7a4e4dbe0e9be Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 22 Nov 2017 23:45:39 +0100
Subject: Use find_thread
The default implementation of threading support in OpenSSL relies on errno being at a differrent address in each thread and expects the user to provide some support (it just uses getpid
in some cases to identify threads, which is not going to work). Use find_thread as was done in BeOS.
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
index 5fab45b..b45ae17 100644
--- a/crypto/cryptlib.c
+++ b/crypto/cryptlib.c
@@ -506,7 +506,7 @@ void CRYPTO_THREADID_current(CRYPTO_THREADID *id)
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentTask());
#elif defined(OPENSSL_SYS_WIN32)
CRYPTO_THREADID_set_numeric(id, (unsigned long)GetCurrentThreadId());
-#elif defined(OPENSSL_SYS_BEOS)
+#elif defined(OPENSSL_SYS_BEOS) || defined(__HAIKU__)
CRYPTO_THREADID_set_numeric(id, (unsigned long)find_thread(NULL));
#else
/* For everything else, default to using the address of 'errno' */
@@ -550,7 +550,7 @@ unsigned long CRYPTO_thread_id(void)
ret = (unsigned long)GetCurrentThreadId();
# elif defined(GETPID_IS_MEANINGLESS)
ret = 1L;
-# elif defined(OPENSSL_SYS_BEOS)
+# elif defined(OPENSSL_SYS_BEOS) || defined(__HAIKU__)
ret = (unsigned long)find_thread(NULL);
# else
ret = (unsigned long)getpid();
--
2.7.0