stop exposing hidden defines in public opensslconf.h

pull in hidden headers instead, patching drectly for Windows support
This commit is contained in:
Brent Cook 2023-02-28 01:51:41 -06:00
parent 65af3925dc
commit b98c56fd5e
9 changed files with 42 additions and 34 deletions

View File

@ -1021,6 +1021,7 @@ target_include_directories(crypto_obj
ecdh ecdh
ecdsa ecdsa
evp evp
hidden
hmac hmac
modes modes
ocsp ocsp

View File

@ -1,7 +1,6 @@
include $(top_srcdir)/Makefile.am.common include $(top_srcdir)/Makefile.am.common
AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL AM_CPPFLAGS += -DLIBRESSL_CRYPTO_INTERNAL
AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1 AM_CPPFLAGS += -I$(top_srcdir)/crypto/asn1
AM_CPPFLAGS += -I$(top_srcdir)/crypto/bio AM_CPPFLAGS += -I$(top_srcdir)/crypto/bio
AM_CPPFLAGS += -I$(top_srcdir)/crypto/bn AM_CPPFLAGS += -I$(top_srcdir)/crypto/bn
@ -134,7 +133,7 @@ libcrypto_la_LIBADD = libcompat.la
if !HAVE_EXPLICIT_BZERO if !HAVE_EXPLICIT_BZERO
libcrypto_la_LIBADD += libcompatnoopt.la libcrypto_la_LIBADD += libcompatnoopt.la
endif endif
libcrypto_la_CPPFLAGS = $(AM_CPPFLAGS) libcrypto_la_CPPFLAGS = -I$(top_srcdir)/crypto/hidden ${AM_CPPFLAGS}
libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL
libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK
if OPENSSL_NO_ASM if OPENSSL_NO_ASM

View File

@ -7,8 +7,6 @@ if(ENABLE_LIBRESSL_INSTALL)
PATTERN "Makefile*" EXCLUDE) PATTERN "Makefile*" EXCLUDE)
endif(ENABLE_LIBRESSL_INSTALL) endif(ENABLE_LIBRESSL_INSTALL)
file(READ openssl/opensslconf.h.in OPENSSLCONF)
file(WRITE openssl/opensslconf.h "${OPENSSLCONF}")
if(HOST_AARCH64) if(HOST_AARCH64)
file(READ arch/aarch64/opensslconf.h OPENSSLCONF) file(READ arch/aarch64/opensslconf.h OPENSSLCONF)
elseif(HOST_ARM) elseif(HOST_ARM)
@ -28,4 +26,4 @@ elseif(HOST_SPARC64)
elseif(HOST_X86_64) elseif(HOST_X86_64)
file(READ arch/amd64/opensslconf.h OPENSSLCONF) file(READ arch/amd64/opensslconf.h OPENSSLCONF)
endif() endif()
file(APPEND openssl/opensslconf.h "${OPENSSLCONF}") file(WRITE openssl/opensslconf.h "${OPENSSLCONF}")

View File

@ -3,40 +3,37 @@ include $(top_srcdir)/Makefile.am.common
if !ENABLE_LIBTLS_ONLY if !ENABLE_LIBTLS_ONLY
opensslincludedir=$(includedir)/openssl opensslincludedir=$(includedir)/openssl
noinst_HEADERS = opensslconf.h.in
BUILT_SOURCES = opensslconf.h BUILT_SOURCES = opensslconf.h
CLEANFILES = opensslconf.h CLEANFILES = opensslconf.h
opensslconf.h: opensslconf.h.in Makefile opensslconf.h: Makefile
-echo "generating opensslconf.h ..." -echo "generating opensslconf.h ..."
-cp $(top_srcdir)/include/openssl/opensslconf.h.in opensslconf.h
-chmod u+w opensslconf.h
if HOST_AARCH64 if HOST_AARCH64
-cat $(top_srcdir)/include/arch/aarch64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/aarch64/opensslconf.h opensslconf.h
endif endif
if HOST_ARM if HOST_ARM
-cat $(top_srcdir)/include/arch/arm/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/arm/opensslconf.h opensslconf.h
endif endif
if HOST_I386 if HOST_I386
-cat $(top_srcdir)/include/arch/i386/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/i386/opensslconf.h opensslconf.h
endif endif
if HOST_MIPS64 if HOST_MIPS64
-cat $(top_srcdir)/include/arch/mips64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/mips64/opensslconf.h opensslconf.h
endif endif
if HOST_POWERPC if HOST_POWERPC
-cat $(top_srcdir)/include/arch/powerpc/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/powerpc/opensslconf.h opensslconf.h
endif endif
if HOST_POWERPC64 if HOST_POWERPC64
-cat $(top_srcdir)/include/arch/powerpc64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/powerpc64/opensslconf.h opensslconf.h
endif endif
if HOST_RISCV64 if HOST_RISCV64
-cat $(top_srcdir)/include/arch/riscv64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/riscv64/opensslconf.h opensslconf.h
endif endif
if HOST_SPARC64 if HOST_SPARC64
-cat $(top_srcdir)/include/arch/sparc64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/sparc64/opensslconf.h opensslconf.h
endif endif
if HOST_X86_64 if HOST_X86_64
-cat $(top_srcdir)/include/arch/amd64/opensslconf.h >> opensslconf.h -cp $(top_srcdir)/include/arch/amd64/opensslconf.h opensslconf.h
endif endif
opensslinclude_HEADERS = opensslconf.h opensslinclude_HEADERS = opensslconf.h

View File

@ -1,15 +0,0 @@
#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
#define __attribute__(a)
#endif
#if defined(LIBRESSL_INTERNAL) && !defined(LIBRESSL_NAMESPACE)
# define LCRYPTO_UNUSED(x)
# define LCRYPTO_USED(x)
# define LCRYPTO_ALIAS1(pre, x)
# define LCRYPTO_ALIAS(x)
# define LSSL_UNUSED(x)
# define LSSL_USED(x)
# define LSSL_ALIAS(x)
#endif /* LIBRESSL_INTERNAL && !LIBRESSL_NAMESPACE */

View File

@ -0,0 +1,13 @@
--- crypto/hidden/crypto_namespace.h.orig 2023-02-28 00:41:43.212756628 -0600
+++ crypto/hidden/crypto_namespace.h 2023-02-28 00:42:01.152756349 -0600
@@ -18,6 +18,10 @@
#ifndef _LIBCRYPTO_CRYPTO_NAMESPACE_H_
#define _LIBCRYPTO_CRYPTO_NAMESPACE_H_
+#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
+#define __attribute__(a)
+#endif
+
/*
* If marked as 'used', then internal calls use the name with prefix "_lcry_"
* and we alias that to the normal name *and* the name with prefix "_libre_";

View File

@ -0,0 +1,13 @@
--- ssl/hidden/ssl_namespace.h.orig 2023-02-28 00:42:20.928756042 -0600
+++ ssl/hidden/ssl_namespace.h 2023-02-28 00:43:16.372755180 -0600
@@ -18,6 +18,10 @@
#ifndef _LIBSSL_SSL_NAMESPACE_H_
#define _LIBSSL_SSL_NAMESPACE_H_
+#if defined(_MSC_VER) && !defined(__clang__) && !defined(__attribute__)
+#define __attribute__(a)
+#endif
+
/*
* If marked as 'used', then internal calls use the name with prefix "_lssl_"
* and we alias that to the normal name.

View File

@ -64,8 +64,9 @@ set(
add_library(ssl_obj OBJECT ${SSL_SRC}) add_library(ssl_obj OBJECT ${SSL_SRC})
target_include_directories(ssl_obj target_include_directories(ssl_obj
PRIVATE PRIVATE
../crypto/bio
. .
hidden
../crypto/bio
../include/compat ../include/compat
PUBLIC PUBLIC
../include) ../include)

View File

@ -31,6 +31,7 @@ remove_bs_objects: libssl.la
-$(AR) dv $(abs_top_builddir)/ssl/.libs/libssl.a \ -$(AR) dv $(abs_top_builddir)/ssl/.libs/libssl.a \
bs_ber.o bs_cbb.o bs_cbs.o bs_ber.o bs_cbb.o bs_cbs.o
libssl_la_CPPFLAGS = -I$(top_srcdir)/ssl/hidden ${AM_CPPFLAGS}
libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined -export-symbols $(top_srcdir)/ssl/ssl.sym libssl_la_LDFLAGS = -version-info @LIBSSL_VERSION@ -no-undefined -export-symbols $(top_srcdir)/ssl/ssl.sym
libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la $(PLATFORM_LDADD) libssl_la_LIBADD = $(abs_top_builddir)/crypto/libcrypto.la $(PLATFORM_LDADD)
libssl_la_LIBADD += libbs.la libssl_la_LIBADD += libbs.la