diff options
author | Brent Cook <busterb@gmail.com> | 2023-02-28 01:51:41 -0600 |
---|---|---|
committer | Brent Cook <busterb@gmail.com> | 2023-02-28 01:51:41 -0600 |
commit | b98c56fd5e86fa76eb55a98a2266a923f64f705c (patch) | |
tree | abfc4a6ae7db1cc78e3f9c530bead5ad353dc3aa | |
parent | 65af3925dcb7fc84000cedc373d5f84db3fc3265 (diff) | |
download | portable-b98c56fd5e86fa76eb55a98a2266a923f64f705c.tar.gz portable-b98c56fd5e86fa76eb55a98a2266a923f64f705c.tar.bz2 portable-b98c56fd5e86fa76eb55a98a2266a923f64f705c.zip |
stop exposing hidden defines in public opensslconf.h
pull in hidden headers instead, patching drectly for Windows support
-rw-r--r-- | crypto/CMakeLists.txt | 1 | ||||
-rw-r--r-- | crypto/Makefile.am | 3 | ||||
-rw-r--r-- | include/CMakeLists.txt | 4 | ||||
-rw-r--r-- | include/openssl/Makefile.am.tpl | 23 | ||||
-rw-r--r-- | include/openssl/opensslconf.h.in | 15 | ||||
-rw-r--r-- | patches/crypto_namespace.h.patch | 13 | ||||
-rw-r--r-- | patches/ssl_namespace.h.patch | 13 | ||||
-rw-r--r-- | ssl/CMakeLists.txt | 3 | ||||
-rw-r--r-- | ssl/Makefile.am | 1 |
9 files changed, 42 insertions, 34 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index dc30a17..45d9786 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
@@ -1021,6 +1021,7 @@ target_include_directories(crypto_obj | |||
1021 | ecdh | 1021 | ecdh |
1022 | ecdsa | 1022 | ecdsa |
1023 | evp | 1023 | evp |
1024 | hidden | ||
1024 | hmac | 1025 | hmac |
1025 | modes | 1026 | modes |
1026 | ocsp | 1027 | ocsp |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 733dcbd..c09d266 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
@@ -1,7 +1,6 @@ | |||
1 | include $(top_srcdir)/Makefile.am.common | 1 | include $(top_srcdir)/Makefile.am.common |
2 | 2 | ||
3 | AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL | 3 | AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL |
4 | |||
5 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1 | 4 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1 |
6 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/bio | 5 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/bio |
7 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/bn | 6 | AM_CPPFLAGS += -I$(top_srcdir)/crypto/bn |
@@ -134,7 +133,7 @@ libcrypto_la_LIBADD = libcompat.la | |||
134 | if !HAVE_EXPLICIT_BZERO | 133 | if !HAVE_EXPLICIT_BZERO |
135 | libcrypto_la_LIBADD += libcompatnoopt.la | 134 | libcrypto_la_LIBADD += libcompatnoopt.la |
136 | endif | 135 | endif |
137 | libcrypto_la_CPPFLAGS = $(AM_CPPFLAGS) | 136 | libcrypto_la_CPPFLAGS = -I$(top_srcdir)/crypto/hidden ${AM_CPPFLAGS} |
138 | libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL | 137 | libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL |
139 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK | 138 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK |
140 | if OPENSSL_NO_ASM | 139 | if OPENSSL_NO_ASM |
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index dafdee7..a08a781 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt | |||
@@ -7,8 +7,6 @@ if(ENABLE_LIBRESSL_INSTALL) | |||
7 | PATTERN "Makefile*" EXCLUDE) | 7 | PATTERN "Makefile*" EXCLUDE) |
8 | endif(ENABLE_LIBRESSL_INSTALL) | 8 | endif(ENABLE_LIBRESSL_INSTALL) |
9 | 9 | ||
10 | file(READ openssl/opensslconf.h.in OPENSSLCONF) | ||
11 | file(WRITE openssl/opensslconf.h "${OPENSSLCONF}") | ||
12 | if(HOST_AARCH64) | 10 | if(HOST_AARCH64) |
13 | file(READ arch/aarch64/opensslconf.h OPENSSLCONF) | 11 | file(READ arch/aarch64/opensslconf.h OPENSSLCONF) |
14 | elseif(HOST_ARM) | 12 | elseif(HOST_ARM) |
@@ -28,4 +26,4 @@ elseif(HOST_SPARC64) | |||
28 | elseif(HOST_X86_64) | 26 | elseif(HOST_X86_64) |
29 | file(READ arch/amd64/opensslconf.h OPENSSLCONF) | 27 | file(READ arch/amd64/opensslconf.h OPENSSLCONF) |
30 | endif() | 28 | endif() |
31 | file(APPEND openssl/opensslconf.h "${OPENSSLCONF}") | 29 | file(WRITE openssl/opensslconf.h "${OPENSSLCONF}") |
diff --git a/include/openssl/Makefile.am.tpl b/include/openssl/Makefile.am.tpl index 167183a..2f67d10 100644 --- a/include/openssl/Makefile.am.tpl +++ b/include/openssl/Makefile.am.tpl | |||
@@ -3,40 +3,37 @@ include $(top_srcdir)/Makefile.am.common | |||
3 | if !ENABLE_LIBTLS_ONLY | 3 | if !ENABLE_LIBTLS_ONLY |
4 | opensslincludedir=$(includedir)/openssl | 4 | opensslincludedir=$(includedir)/openssl |
5 | 5 | ||
6 | noinst_HEADERS = opensslconf.h.in | ||
7 | BUILT_SOURCES = opensslconf.h | 6 | BUILT_SOURCES = opensslconf.h |
8 | CLEANFILES = opensslconf.h | 7 | CLEANFILES = opensslconf.h |
9 | 8 | ||
10 | opensslconf.h: opensslconf.h.in Makefile | 9 | opensslconf.h: Makefile |
11 | -echo "generating opensslconf.h ..." | 10 | -echo "generating opensslconf.h ..." |
12 | -cp $(top_srcdir)/include/openssl/opensslconf.h.in opensslconf.h | ||
13 | -chmod u+w opensslconf.h | ||
14 | if HOST_AARCH64 | 11 | if HOST_AARCH64 |
15 | -cat $(top_srcdir)/include/arch/aarch64/opensslconf.h >> opensslconf.h | 12 | -cp $(top_srcdir)/include/arch/aarch64/opensslconf.h opensslconf.h |
16 | endif | 13 | endif |
17 | if HOST_ARM | 14 | if HOST_ARM |
18 | -cat $(top_srcdir)/include/arch/arm/opensslconf.h >> opensslconf.h | 15 | -cp $(top_srcdir)/include/arch/arm/opensslconf.h opensslconf.h |
19 | endif | 16 | endif |
20 | if HOST_I386 | 17 | if HOST_I386 |
21 | -cat $(top_srcdir)/include/arch/i386/opensslconf.h >> opensslconf.h | 18 | -cp $(top_srcdir)/include/arch/i386/opensslconf.h opensslconf.h |
22 | endif | 19 | endif |
23 | if HOST_MIPS64 | 20 | if HOST_MIPS64 |
24 | -cat $(top_srcdir)/include/arch/mips64/opensslconf.h >> opensslconf.h | 21 | -cp $(top_srcdir)/include/arch/mips64/opensslconf.h opensslconf.h |
25 | endif | 22 | endif |
26 | if HOST_POWERPC | 23 | if HOST_POWERPC |
27 | -cat $(top_srcdir)/include/arch/powerpc/opensslconf.h >> opensslconf.h | 24 | -cp $(top_srcdir)/include/arch/powerpc/opensslconf.h opensslconf.h |
28 | endif | 25 | endif |
29 | if HOST_POWERPC64 | 26 | if HOST_POWERPC64 |
30 | -cat $(top_srcdir)/include/arch/powerpc64/opensslconf.h >> opensslconf.h | 27 | -cp $(top_srcdir)/include/arch/powerpc64/opensslconf.h opensslconf.h |
31 | endif | 28 | endif |
32 | if HOST_RISCV64 | 29 | if HOST_RISCV64 |
33 | -cat $(top_srcdir)/include/arch/riscv64/opensslconf.h >> opensslconf.h | 30 | -cp $(top_srcdir)/include/arch/riscv64/opensslconf.h opensslconf.h |
34 | endif | 31 | endif |
35 | if HOST_SPARC64 | 32 | if HOST_SPARC64 |
36 | -cat $(top_srcdir)/include/arch/sparc64/opensslconf.h >> opensslconf.h | 33 | -cp $(top_srcdir)/include/arch/sparc64/opensslconf.h opensslconf.h |
37 | endif | 34 | endif |
38 | if HOST_X86_64 | 35 | if HOST_X86_64 |
39 | -cat $(top_srcdir)/include/arch/amd64/opensslconf.h >> opensslconf.h | 36 | -cp $(top_srcdir)/include/arch/amd64/opensslconf.h opensslconf.h |
40 | endif | 37 | endif |
41 | 38 | ||
42 | opensslinclude_HEADERS = opensslconf.h | 39 | opensslinclude_HEADERS = opensslconf.h |
diff --git a/include/openssl/opensslconf.h.in b/include/openssl/opensslconf.h.in deleted file mode 100644 index 8842f00..0000000 --- a/include/openssl/opensslconf.h.in +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | #if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__) | ||
2 | #define __attribute__(a) | ||
3 | #endif | ||
4 | |||
5 | #if defined(LIBRESSL_INTERNAL) && !defined(LIBRESSL_NAMESPACE) | ||
6 | # define LCRYPTO_UNUSED(x) | ||
7 | # define LCRYPTO_USED(x) | ||
8 | # define LCRYPTO_ALIAS1(pre, x) | ||
9 | # define LCRYPTO_ALIAS(x) | ||
10 | |||
11 | # define LSSL_UNUSED(x) | ||
12 | # define LSSL_USED(x) | ||
13 | # define LSSL_ALIAS(x) | ||
14 | #endif /* LIBRESSL_INTERNAL && !LIBRESSL_NAMESPACE */ | ||
15 | |||
diff --git a/patches/crypto_namespace.h.patch b/patches/crypto_namespace.h.patch new file mode 100644 index 0000000..2751524 --- /dev/null +++ b/patches/crypto_namespace.h.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | --- crypto/hidden/crypto_namespace.h.orig 2023-02-28 00:41:43.212756628 -0600 | ||
2 | +++ crypto/hidden/crypto_namespace.h 2023-02-28 00:42:01.152756349 -0600 | ||
3 | @@ -18,6 +18,10 @@ | ||
4 | #ifndef _LIBCRYPTO_CRYPTO_NAMESPACE_H_ | ||
5 | #define _LIBCRYPTO_CRYPTO_NAMESPACE_H_ | ||
6 | |||
7 | +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__) | ||
8 | +#define __attribute__(a) | ||
9 | +#endif | ||
10 | + | ||
11 | /* | ||
12 | * If marked as 'used', then internal calls use the name with prefix "_lcry_" | ||
13 | * and we alias that to the normal name *and* the name with prefix "_libre_"; | ||
diff --git a/patches/ssl_namespace.h.patch b/patches/ssl_namespace.h.patch new file mode 100644 index 0000000..649e862 --- /dev/null +++ b/patches/ssl_namespace.h.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | --- ssl/hidden/ssl_namespace.h.orig 2023-02-28 00:42:20.928756042 -0600 | ||
2 | +++ ssl/hidden/ssl_namespace.h 2023-02-28 00:43:16.372755180 -0600 | ||
3 | @@ -18,6 +18,10 @@ | ||
4 | #ifndef _LIBSSL_SSL_NAMESPACE_H_ | ||
5 | #define _LIBSSL_SSL_NAMESPACE_H_ | ||
6 | |||
7 | +#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__) | ||
8 | +#define __attribute__(a) | ||
9 | +#endif | ||
10 | + | ||
11 | /* | ||
12 | * If marked as 'used', then internal calls use the name with prefix "_lssl_" | ||
13 | * and we alias that to the normal name. | ||
diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index 173c3b5..f5d52f7 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt | |||
@@ -64,8 +64,9 @@ set( | |||
64 | add_library(ssl_obj OBJECT ${SSL_SRC}) | 64 | add_library(ssl_obj OBJECT ${SSL_SRC}) |
65 | target_include_directories(ssl_obj | 65 | target_include_directories(ssl_obj |
66 | PRIVATE | 66 | PRIVATE |
67 | ../crypto/bio | ||
68 | . | 67 | . |
68 | hidden | ||
69 | ../crypto/bio | ||
69 | ../include/compat | 70 | ../include/compat |
70 | PUBLIC | 71 | PUBLIC |
71 | ../include) | 72 | ../include) |
diff --git a/ssl/Makefile.am b/ssl/Makefile.am index a2155fb..d27e2af 100644 --- a/ssl/Makefile.am +++ b/ssl/Makefile.am | |||
@@ -31,6 +31,7 @@ remove_bs_objects: libssl.la | |||
31 | -$(AR) dv $(abs_top_builddir)/ssl/.libs/libssl.a \ | 31 | -$(AR) dv $(abs_top_builddir)/ssl/.libs/libssl.a \ |
32 | bs_ber.o bs_cbb.o bs_cbs.o | 32 | bs_ber.o bs_cbb.o bs_cbs.o |
33 | 33 | ||
34 | libssl_la_CPPFLAGS = -I$(top_srcdir)/ssl/hidden ${AM_CPPFLAGS} | ||
34 | libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined -export-symbols $(top_srcdir)/ssl/ssl.sym | 35 | libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined -export-symbols $(top_srcdir)/ssl/ssl.sym |
35 | libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la $(PLATFORM_LDADD) | 36 | libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la $(PLATFORM_LDADD) |
36 | libssl_la_LIBADD += libbs.la | 37 | libssl_la_LIBADD += libbs.la |