From 37de68c96531e9d968f45f345c813d3d240e6a48 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 23 Apr 2015 13:33:35 +0200 Subject: [PATCH] openssl: Enable all assembly optimisations build SSE2 optimised version Fixes #10814 --- config/rootfiles/common/i586/openssl-sse2 | 2 + .../core/90/filelists/i586/openssl-sse2 | 1 + lfs/openssl | 62 ++++++++++++------- make.sh | 1 + src/patches/openssl-1.0.2a-rpmbuild.patch | 29 ++++++--- 5 files changed, 62 insertions(+), 33 deletions(-) create mode 100644 config/rootfiles/common/i586/openssl-sse2 create mode 120000 config/rootfiles/core/90/filelists/i586/openssl-sse2 diff --git a/config/rootfiles/common/i586/openssl-sse2 b/config/rootfiles/common/i586/openssl-sse2 new file mode 100644 index 0000000000..59bfce3e26 --- /dev/null +++ b/config/rootfiles/common/i586/openssl-sse2 @@ -0,0 +1,2 @@ +usr/lib/sse2/libcrypto.so.10 +usr/lib/sse2/libssl.so.10 diff --git a/config/rootfiles/core/90/filelists/i586/openssl-sse2 b/config/rootfiles/core/90/filelists/i586/openssl-sse2 new file mode 120000 index 0000000000..f424713d6c --- /dev/null +++ b/config/rootfiles/core/90/filelists/i586/openssl-sse2 @@ -0,0 +1 @@ +../../../../common/i586/openssl-sse2 \ No newline at end of file diff --git a/lfs/openssl b/lfs/openssl index 6f31e02b1f..6872f103ed 100644 --- a/lfs/openssl +++ b/lfs/openssl @@ -30,19 +30,45 @@ THISAPP = openssl-$(VER) DL_FILE = $(THISAPP).tar.gz DL_FROM = $(URL_IPFIRE) DIR_APP = $(DIR_SRC)/$(THISAPP) -TARGET = $(DIR_INFO)/$(THISAPP) + +ifeq "$(SSE2)" "1" + TARGET = $(DIR_INFO)/$(THISAPP)-sse2 +else + TARGET = $(DIR_INFO)/$(THISAPP) +endif + +CFLAGS += -DPURIFY +export RPM_OPT_FLAGS = $(CFLAGS) + +CONFIGURE_OPTIONS = \ + --prefix=/usr \ + --openssldir=/etc/ssl \ + --enginesdir=/usr/lib/openssl/engines \ + shared \ + zlib-dynamic \ + enable-camellia \ + enable-md2 \ + enable-seed \ + enable-tlsext \ + enable-rfc3779 \ + no-idea \ + no-mdc2 \ + no-rc5 \ + no-srp \ + -DSSL_FORBID_ENULL ifeq "$(MACHINE)" "i586" - CONFIGURE_ARGS = linux-generic32 no-asm 386 + CONFIGURE_OPTIONS += linux-elf + +ifneq "$(SSE2)" "1" + CONFIGURE_OPTIONS += no-sse2 +endif endif ifeq "$(MACHINE)" "armv5tel" - CONFIGURE_ARGS = linux-generic32 + CONFIGURE_OPIONS += linux-generic32 endif -CFLAGS += -DPURIFY -export RPM_OPT_FLAGS = $(CFLAGS) - ############################################################################### # Top-level Rules ############################################################################### @@ -93,27 +119,16 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && find crypto/ -name Makefile -exec \ sed 's/^ASFLAGS=/&-Wa,--noexecstack /' -i {} \; - cd $(DIR_APP) && ./Configure \ - --prefix=/usr \ - --openssldir=/etc/ssl \ - --enginesdir=/usr/lib/openssl/engines \ - shared \ - zlib-dynamic \ - enable-camellia \ - enable-md2 \ - enable-seed \ - enable-tlsext \ - enable-rfc3779 \ - no-idea \ - no-mdc2 \ - no-rc5 \ - no-srp \ - $(CONFIGURE_ARGS) \ - -DSSL_FORBID_ENULL + cd $(DIR_APP) && ./Configure $(CONFIGURE_OPTIONS) cd $(DIR_APP) && make depend cd $(DIR_APP) && make +ifeq "$(SSE2)" "1" + -mkdir -pv /usr/lib/sse2 + cd $(DIR_APP) && install -m 755 \ + libcrypto.so.10 libssl.so.10 /usr/lib/sse2 +else # Install everything. cd $(DIR_APP) && make install install -m 0644 $(DIR_SRC)/config/ssl/openssl.cnf /etc/ssl @@ -125,6 +140,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -pv /usr/lib/openssl rm -vfr /usr/lib/openssl/engines mv -v /usr/lib/engines /usr/lib/openssl +endif @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/make.sh b/make.sh index 6662096a94..55387121e8 100755 --- a/make.sh +++ b/make.sh @@ -461,6 +461,7 @@ buildipfire() { esac ipfiremake xtables-addons USPACE="1" ipfiremake openssl + [ "${TARGET_ARCH}" = "i586" ] && ipfiremake openssl SSE2="1" ipfiremake openssl-compat ipfiremake libgpg-error ipfiremake libgcrypt diff --git a/src/patches/openssl-1.0.2a-rpmbuild.patch b/src/patches/openssl-1.0.2a-rpmbuild.patch index 3cab5c2778..2395d86664 100644 --- a/src/patches/openssl-1.0.2a-rpmbuild.patch +++ b/src/patches/openssl-1.0.2a-rpmbuild.patch @@ -1,6 +1,6 @@ -diff -up openssl-1.0.1e/Configure.rpmbuild openssl-1.0.1e/Configure ---- openssl-1.0.2a.vanilla/Configure 2015-03-19 13:30:36.000000000 +0000 -+++ openssl-1.0.2a/Configure 2015-04-19 09:53:04.381491868 +0000 +diff -Nur openssl-1.0.2a-vanilla/Configure openssl-1.0.2a/Configure +--- openssl-1.0.2a-vanilla/Configure 2015-03-19 13:30:36.000000000 +0000 ++++ openssl-1.0.2a/Configure 2015-04-23 10:31:41.336569854 +0000 @@ -348,7 +348,7 @@ #### # *-generic* is endian-neutral target, but ./config is free to @@ -10,7 +10,16 @@ diff -up openssl-1.0.1e/Configure.rpmbuild openssl-1.0.1e/Configure "linux-ppc", "gcc:-DB_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL:${ppc32_asm}:linux32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ####################################################################### -@@ -1675,7 +1676,7 @@ while () +@@ -389,7 +389,7 @@ + "linux64-mips64", "gcc:-mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips64_asm}:64:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64", + #### IA-32 targets... + "linux-ia32-icc", "icc:-DL_ENDIAN -O2::-D_REENTRANT::-ldl -no_cpprt:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-KPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +-"linux-elf", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"linux-elf", "gcc:-DL_ENDIAN \$(CFLAGS) -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_SONAMEVER)", + "linux-aout", "gcc:-DL_ENDIAN -O3 -fomit-frame-pointer -march=i486 -Wall::(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_asm}:a.out", + #### + "linux-generic64","gcc:-O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", +@@ -1737,7 +1737,7 @@ elsif ($shared_extension ne "" && $shared_extension =~ /^\.s([ol])\.[^\.]*\.[^\.]*$/) { my $sotmp = $1; @@ -19,10 +28,10 @@ diff -up openssl-1.0.1e/Configure.rpmbuild openssl-1.0.1e/Configure } elsif ($shared_extension ne "" && $shared_extension =~ /^\.[^\.]*\.[^\.]*\.dylib$/) { -diff -up openssl-1.0.1e/Makefile.org.rpmbuild openssl-1.0.1e/Makefile.org ---- openssl-1.0.1e/Makefile.org.rpmbuild 2013-02-11 16:26:04.000000000 +0100 -+++ openssl-1.0.1e/Makefile.org 2014-08-13 19:19:53.218005759 +0200 -@@ -10,6 +10,7 @@ SHLIB_VERSION_HISTORY= +diff -Nur openssl-1.0.2a-vanilla/Makefile.org openssl-1.0.2a/Makefile.org +--- openssl-1.0.2a-vanilla/Makefile.org 2015-03-19 13:30:36.000000000 +0000 ++++ openssl-1.0.2a/Makefile.org 2015-04-23 10:30:03.184371933 +0000 +@@ -10,6 +10,7 @@ SHLIB_MAJOR= SHLIB_MINOR= SHLIB_EXT= @@ -30,7 +39,7 @@ diff -up openssl-1.0.1e/Makefile.org.rpmbuild openssl-1.0.1e/Makefile.org PLATFORM=dist OPTIONS= CONFIGURE_ARGS= -@@ -333,10 +334,9 @@ clean-shared: +@@ -335,10 +336,9 @@ link-shared: @ set -e; for i in $(SHLIBDIRS); do \ $(MAKE) -f $(HERE)/Makefile.shared -e $(BUILDENV) \ @@ -42,7 +51,7 @@ diff -up openssl-1.0.1e/Makefile.org.rpmbuild openssl-1.0.1e/Makefile.org done build-shared: do_$(SHLIB_TARGET) link-shared -@@ -347,7 +347,7 @@ do_$(SHLIB_TARGET): +@@ -349,7 +349,7 @@ libs="$(LIBKRB5) $$libs"; \ fi; \ $(CLEARENV) && $(MAKE) -f Makefile.shared -e $(BUILDENV) \ -- 2.39.2