diff options
author | Brent Cook <bcook@openbsd.org> | 2014-12-06 18:43:58 -0600 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2014-12-07 16:26:28 -0600 |
commit | 03cd45e2c78b0298ab006fb64a4cda4fe6ab5657 (patch) | |
tree | b6169d60691749d3a8a27c366646f7ad34d5c7d1 /update.sh | |
parent | e57d5d8be3fbab0aa2ffa87f79d5fb079a0af2e9 (diff) | |
download | portable-03cd45e2c78b0298ab006fb64a4cda4fe6ab5657.tar.gz portable-03cd45e2c78b0298ab006fb64a4cda4fe6ab5657.tar.bz2 portable-03cd45e2c78b0298ab006fb64a4cda4fe6ab5657.zip |
Enable optimized crypto operations for x86_64
This adds initial support for assembly crypto acceleration on x86_64 for
ELF (Linux, *BSD, Solaris) and Mach-O (OS-X) systems.
The build method is a little different than OpenSSL and OpenBSD. All
the .s files are generated ahead of time when the tarball is generated,
so there are no complicated makefile rules at configure/build time. This
also means the builds are faster and perl is not required on the build
system.
Thanks to Wouter Clarie for providing the initial cleanup and patch
that this is based on.
Diffstat (limited to 'update.sh')
-rwxr-xr-x | update.sh | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -5,6 +5,7 @@ openbsd_branch=`cat OPENBSD_BRANCH` | |||
5 | libressl_version=`cat VERSION` | 5 | libressl_version=`cat VERSION` |
6 | 6 | ||
7 | # pull in latest upstream code | 7 | # pull in latest upstream code |
8 | echo "pulling upstream openbsd source" | ||
8 | if [ ! -d openbsd ]; then | 9 | if [ ! -d openbsd ]; then |
9 | if [ -z "$LIBRESSL_GIT" ]; then | 10 | if [ -z "$LIBRESSL_GIT" ]; then |
10 | git clone https://github.com/libressl-portable/openbsd.git | 11 | git clone https://github.com/libressl-portable/openbsd.git |
@@ -16,7 +17,7 @@ fi | |||
16 | git checkout $openbsd_branch | 17 | git checkout $openbsd_branch |
17 | git pull --rebase) | 18 | git pull --rebase) |
18 | 19 | ||
19 | # setup source paths | 20 | # setup source paths |
20 | dir=`pwd` | 21 | dir=`pwd` |
21 | libc_src=$dir/openbsd/src/lib/libc | 22 | libc_src=$dir/openbsd/src/lib/libc |
22 | libc_regress=$dir/openbsd/src/regress/lib/libc | 23 | libc_regress=$dir/openbsd/src/regress/lib/libc |
@@ -93,6 +94,7 @@ copy_hdrs crypto "stack/stack.h lhash/lhash.h stack/safestack.h opensslv.h | |||
93 | copy_hdrs ssl "srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h" | 94 | copy_hdrs ssl "srtp.h ssl.h ssl2.h ssl3.h ssl23.h tls1.h dtls1.h" |
94 | 95 | ||
95 | # copy libcrypto source | 96 | # copy libcrypto source |
97 | echo copying libcrypto source | ||
96 | rm -f crypto/*.c crypto/*.h | 98 | rm -f crypto/*.c crypto/*.h |
97 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' crypto/Makefile.am` ; do | 99 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' crypto/Makefile.am` ; do |
98 | dir=`dirname $i` | 100 | dir=`dirname $i` |
@@ -106,13 +108,40 @@ done | |||
106 | $CP crypto/compat/b_win.c crypto/bio | 108 | $CP crypto/compat/b_win.c crypto/bio |
107 | $CP crypto/compat/ui_openssl_win.c crypto/ui | 109 | $CP crypto/compat/ui_openssl_win.c crypto/ui |
108 | 110 | ||
111 | # generate assembly crypto algorithms | ||
112 | asm_src=$libssl_src/src/crypto | ||
113 | for abi in elf macosx; do | ||
114 | echo generating ASM source for $abi | ||
115 | perl $asm_src/aes/asm/aes-x86_64.pl $abi > crypto/aes/aes-${abi}-x86_64.s | ||
116 | perl $asm_src/aes/asm/vpaes-x86_64.pl $abi > crypto/aes/vpaes-${abi}-x86_64.s | ||
117 | perl $asm_src/aes/asm/bsaes-x86_64.pl $abi > crypto/aes/bsaes-${abi}-x86_64.s | ||
118 | perl $asm_src/aes/asm/aesni-x86_64.pl $abi > crypto/aes/aesni-${abi}-x86_64.s | ||
119 | perl $asm_src/aes/asm/aesni-sha1-x86_64.pl $abi > crypto/aes/aesni-sha1-${abi}-x86_64.s | ||
120 | perl $asm_src/bn/asm/modexp512-x86_64.pl $abi > crypto/bn/modexp512-${abi}-x86_64.s | ||
121 | perl $asm_src/bn/asm/x86_64-mont.pl $abi > crypto/bn/mont-${abi}-x86_64.s | ||
122 | perl $asm_src/bn/asm/x86_64-mont5.pl $abi > crypto/bn/mont5-${abi}-x86_64.s | ||
123 | perl $asm_src/bn/asm/x86_64-gf2m.pl $abi > crypto/bn/gf2m-${abi}-x86_64.s | ||
124 | perl $asm_src/camellia/asm/cmll-x86_64.pl $abi > crypto/camellia/cmll-${abi}-x86_64.s | ||
125 | perl $asm_src/md5/asm/md5-x86_64.pl $abi > crypto/md5/md5-${abi}-x86_64.s | ||
126 | perl $asm_src/modes/asm/ghash-x86_64.pl $abi > crypto/modes/ghash-${abi}-x86_64.s | ||
127 | perl $asm_src/rc4/asm/rc4-x86_64.pl $abi > crypto/rc4/rc4-${abi}-x86_64.s | ||
128 | perl $asm_src/rc4/asm/rc4-md5-x86_64.pl $abi > crypto/rc4/rc4-md5-${abi}-x86_64.s | ||
129 | perl $asm_src/sha/asm/sha1-x86_64.pl $abi > crypto/sha/sha1-${abi}-x86_64.s | ||
130 | perl $asm_src/sha/asm/sha512-x86_64.pl $abi crypto/sha/sha256-${abi}-x86_64.S | ||
131 | perl $asm_src/sha/asm/sha512-x86_64.pl $abi crypto/sha/sha512-${abi}-x86_64.S | ||
132 | perl $asm_src/whrlpool/asm/wp-x86_64.pl $abi > crypto/whrlpool/wp-${abi}-x86_64.s | ||
133 | perl $asm_src/x86_64cpuid.pl $abi crypto/cpuid-${abi}-x86_64.S | ||
134 | done | ||
135 | |||
109 | # copy libtls source | 136 | # copy libtls source |
137 | echo copying libtls source | ||
110 | rm -f tls/*.c tls/*.h | 138 | rm -f tls/*.c tls/*.h |
111 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do | 139 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' tls/Makefile.am` ; do |
112 | cp $libtls_src/$i tls | 140 | cp $libtls_src/$i tls |
113 | done | 141 | done |
114 | 142 | ||
115 | # copy openssl(1) source | 143 | # copy openssl(1) source |
144 | echo "copying openssl(1) source" | ||
116 | $CP $libc_src/stdlib/strtonum.c apps | 145 | $CP $libc_src/stdlib/strtonum.c apps |
117 | $CP $libcrypto_src/openssl.cnf apps | 146 | $CP $libcrypto_src/openssl.cnf apps |
118 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' apps/Makefile.am` ; do | 147 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' apps/Makefile.am` ; do |
@@ -122,12 +151,14 @@ for i in `awk '/SOURCES|HEADERS/ { print $3 }' apps/Makefile.am` ; do | |||
122 | done | 151 | done |
123 | 152 | ||
124 | # copy libssl source | 153 | # copy libssl source |
154 | echo "copying libssl source" | ||
125 | rm -f ssl/*.c ssl/*.h | 155 | rm -f ssl/*.c ssl/*.h |
126 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' ssl/Makefile.am` ; do | 156 | for i in `awk '/SOURCES|HEADERS/ { print $3 }' ssl/Makefile.am` ; do |
127 | cp $libssl_src/src/ssl/$i ssl | 157 | cp $libssl_src/src/ssl/$i ssl |
128 | done | 158 | done |
129 | 159 | ||
130 | # copy libcrypto tests | 160 | # copy libcrypto tests |
161 | echo "copying tests" | ||
131 | rm -f tests/biotest.c | 162 | rm -f tests/biotest.c |
132 | for i in aead/aeadtest.c aeswrap/aes_wrap.c base64/base64test.c bf/bftest.c \ | 163 | for i in aead/aeadtest.c aeswrap/aes_wrap.c base64/base64test.c bf/bftest.c \ |
133 | bn/general/bntest.c bn/mont/mont.c \ | 164 | bn/general/bntest.c bn/mont/mont.c \ |
@@ -223,6 +254,7 @@ echo "EXTRA_DIST += testssl ca.pem server.pem" >> tests/Makefile.am | |||
223 | done | 254 | done |
224 | ) | 255 | ) |
225 | 256 | ||
257 | echo "copying manpages" | ||
226 | # copy manpages | 258 | # copy manpages |
227 | (cd man | 259 | (cd man |
228 | $CP Makefile.am.tpl Makefile.am | 260 | $CP Makefile.am.tpl Makefile.am |