From 3c7747fd8bcaaf2eb2f901c34d573bae52fea0c5 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Wed, 15 Feb 2023 07:56:44 -0600 Subject: [PATCH] generate opensslconf.h based on host cpu architecture --- .gitignore | 2 ++ Makefile.am | 2 +- Makefile.am.common | 4 +++- include/Makefile.am | 14 ++++++++++++++ include/openssl/opensslconf.h.in | 15 +++++++++++++++ patches/opensslconf.h.patch | 24 ------------------------ update.sh | 7 ++++++- 7 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 include/openssl/opensslconf.h.in delete mode 100644 patches/opensslconf.h.patch diff --git a/.gitignore b/.gitignore index 3a0b97f4e4..a47dd50289 100644 --- a/.gitignore +++ b/.gitignore @@ -145,6 +145,7 @@ stamp-h1 stamp-h2 include/openssl/Makefile.am +include/arch VERSION crypto/VERSION @@ -152,6 +153,7 @@ ssl/VERSION tls/VERSION libtls-standalone/VERSION +ssl/hidden ssl/*.c ssl/*.h tls/*.c diff --git a/Makefile.am b/Makefile.am index ed59df0bf5..d28692a23d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = crypto ssl tls include apps man +SUBDIRS = include crypto ssl tls apps man if ENABLE_TESTS SUBDIRS += tests endif diff --git a/Makefile.am.common b/Makefile.am.common index 87aa807031..5405704b23 100644 --- a/Makefile.am.common +++ b/Makefile.am.common @@ -1,3 +1,5 @@ AM_CFLAGS = -AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL +AM_CPPFLAGS = -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(abs_top_builddir)/include +AM_CPPFLAGS += -I$(top_srcdir)/include/compat -DLIBRESSL_INTERNAL AM_CPPFLAGS += -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= diff --git a/include/Makefile.am b/include/Makefile.am index aed67211e9..26e82fe39d 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -44,4 +44,18 @@ noinst_HEADERS += compat/sys/time.h noinst_HEADERS += compat/sys/types.h noinst_HEADERS += compat/sys/uio.h +noinst_HEADERS += arch/aarch64/opensslconf.h +noinst_HEADERS += arch/alpha/opensslconf.h +noinst_HEADERS += arch/amd64/opensslconf.h +noinst_HEADERS += arch/arm/opensslconf.h +noinst_HEADERS += arch/hppa/opensslconf.h +noinst_HEADERS += arch/i386/opensslconf.h +noinst_HEADERS += arch/m88k/opensslconf.h +noinst_HEADERS += arch/mips64/opensslconf.h +noinst_HEADERS += arch/powerpc/opensslconf.h +noinst_HEADERS += arch/powerpc64/opensslconf.h +noinst_HEADERS += arch/riscv64/opensslconf.h +noinst_HEADERS += arch/sh/opensslconf.h +noinst_HEADERS += arch/sparc64/opensslconf.h + include_HEADERS = tls.h diff --git a/include/openssl/opensslconf.h.in b/include/openssl/opensslconf.h.in new file mode 100644 index 0000000000..8842f00d39 --- /dev/null +++ b/include/openssl/opensslconf.h.in @@ -0,0 +1,15 @@ +#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 */ + diff --git a/patches/opensslconf.h.patch b/patches/opensslconf.h.patch deleted file mode 100644 index ee5d645bd7..0000000000 --- a/patches/opensslconf.h.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- include/openssl/opensslconf.h.orig Tue Nov 22 21:08:27 2022 -+++ include/openssl/opensslconf.h Wed Nov 23 12:38:07 2022 -@@ -1,6 +1,21 @@ - #include - /* crypto/opensslconf.h.in */ - -+#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 */ -+ - #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) - #define OPENSSLDIR "/etc/ssl" - #endif diff --git a/update.sh b/update.sh index 3d0a608e6c..29600a4703 100755 --- a/update.sh +++ b/update.sh @@ -70,7 +70,6 @@ fi $CP $libssl_src/LICENSE COPYING -$CP $libcrypto_src/arch/amd64/opensslconf.h include/openssl $CP $libcrypto_src/opensslfeatures.h include/openssl $CP $libssl_src/pqueue.h include @@ -152,6 +151,12 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' crypto/Makefile.am` ; do fi done +for i in $libcrypto_src/arch/*; do + arch=`basename $i` + mkdir -p include/arch/$arch + $CP $libcrypto_src/arch/$arch/opensslconf.h include/arch/$arch/ +done + for i in $libcrypto_src/bn/arch/*; do arch=`basename $i` mkdir -p crypto/bn/arch/$arch