xref: /OK3568_Linux_fs/buildroot/package/tor/0001-Fix-static-linking-with-OpenSSL.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From ba6b8ee5b6dee19493a150c3715b0e202440d206 Mon Sep 17 00:00:00 2001
2From: Bernd Kuhls <bernd.kuhls@t-online.de>
3Date: Thu, 24 Jan 2019 18:19:51 +0100
4Subject: [PATCH] Fix static linking with OpenSSL
5
6Adjust link order of libz to solve bug with static linking
7and remove host paths when looking for openssl.
8
9[Vincent:
10 - Adapt the patch to make it apply on the new version.]
11[Bernd: rebased for tor-0.2.7.6, 0.2.8.10, 0.2.9.9, 0.3.1.7, 0.3.2.10,
12        0.3.4.8, 0.3.5.7, 0.4.4.5, 0.4.5.6 & 0.4.6.7]
13[Fabrice: fix detection of openssl functions in 0.3.5.8]
14Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
15Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
16Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
17---
18 configure.ac         | 4 ++--
19 src/test/include.am  | 8 ++++----
20 src/tools/include.am | 4 ++--
21 4 files changed, 9 insertions(+), 9 deletions(-)
22
23diff --git a/configure.ac b/configure.ac
24index 05e1392cf..580befa6b 100644
25--- a/configure.ac
26+++ b/configure.ac
27@@ -1074,7 +1074,7 @@ AC_ARG_WITH(ssl-dir,
28   ])
29
30 AC_MSG_NOTICE([Now, we'll look for OpenSSL >= 1.0.1])
31-TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto $TOR_LIB_GDI $TOR_LIB_WS32 $TOR_LIB_CRYPT32],
32+TOR_SEARCH_LIBRARY(openssl, $tryssldir, [-lssl -lcrypto -lz $TOR_LIB_GDI $TOR_LIB_WS32 $TOR_LIB_CRYPT32],
33     [#include <openssl/ssl.h>
34      char *getenv(const char *);],
35     [struct ssl_cipher_st;
36@@ -1104,7 +1104,7 @@ dnl Now check for particular openssl functions.
37 save_LIBS="$LIBS"
38 save_LDFLAGS="$LDFLAGS"
39 save_CPPFLAGS="$CPPFLAGS"
40-LIBS="$TOR_OPENSSL_LIBS $LIBS"
41+LIBS="$TOR_OPENSSL_LIBS -lz $LIBS"
42 LDFLAGS="$TOR_LDFLAGS_openssl $LDFLAGS"
43 CPPFLAGS="$TOR_CPPFLAGS_openssl $CPPFLAGS"
44
45diff --git a/src/test/include.am b/src/test/include.am
46index ecb768957..39a622e88 100644
47--- a/src/test/include.am
48+++ b/src/test/include.am
49@@ -399,8 +399,8 @@ src_test_test_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
50 src_test_test_ntor_cl_LDADD = \
51 	libtor.a \
52 	$(rust_ldadd) \
53-	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
54-	$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
55+	@TOR_LIB_MATH@ \
56+	$(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ \
57 	@CURVE25519_LIBS@ @TOR_LZMA_LIBS@ @TOR_TRACE_LIBS@
58 src_test_test_ntor_cl_AM_CPPFLAGS =	       \
59 	$(AM_CPPFLAGS)
60@@ -409,8 +409,8 @@
61 src_test_test_hs_ntor_cl_LDFLAGS = @TOR_LDFLAGS_zlib@ $(TOR_LDFLAGS_CRYPTLIB)
62 src_test_test_hs_ntor_cl_LDADD = \
63 	libtor.a \
64-	@TOR_ZLIB_LIBS@ @TOR_LIB_MATH@ \
65-	$(TOR_LIBS_CRYPTLIB) @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
66+	@TOR_LIB_MATH@ \
67+	$(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ @TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ \
68         @CURVE25519_LIBS@ @TOR_TRACE_LIBS@
69 src_test_test_hs_ntor_cl_AM_CPPFLAGS =	       \
70 	$(AM_CPPFLAGS)
71diff --git a/src/tools/include.am b/src/tools/include.am
72index f7aa7e0d1..4c4e8aa7a 100644
73--- a/src/tools/include.am
74+++ b/src/tools/include.am
75@@ -35,7 +35,7 @@ src_tools_tor_gencert_LDADD = \
76 	$(TOR_CRYPTO_LIBS) \
77 	$(TOR_UTIL_LIBS) \
78 	$(rust_ldadd) \
79-	@TOR_LIB_MATH@ @TOR_ZLIB_LIBS@ $(TOR_LIBS_CRYPTLIB) \
80+	@TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ \
81 	@TOR_LIB_WS32@ @TOR_LIB_IPHLPAPI@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@ @TOR_LIB_USERENV@ @CURVE25519_LIBS@
82 endif
83
84@@ -45,7 +45,7 @@ src_tools_tor_print_ed_signing_cert_LDADD = \
85 	src/trunnel/libor-trunnel.a \
86         $(TOR_CRYPTO_LIBS) \
87         $(TOR_UTIL_LIBS) \
88-	@TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) \
89+	@TOR_LIB_MATH@ $(TOR_LIBS_CRYPTLIB) @TOR_ZLIB_LIBS@ \
90 	@TOR_LIB_WS32@ @TOR_LIB_USERENV@ @TOR_LIB_SHLWAPI@ @TOR_LIB_GDI@
91
92 if USE_NSS
93--
942.20.1
95