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 | |
| 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.
| -rw-r--r-- | .gitignore | 4 | ||||
| -rw-r--r-- | configure.ac | 45 | ||||
| -rw-r--r-- | crypto/Makefile.am | 28 | ||||
| -rw-r--r-- | crypto/Makefile.am.elf-x86_64 | 41 | ||||
| -rw-r--r-- | crypto/Makefile.am.macosx-x86_64 | 41 | ||||
| -rwxr-xr-x | update.sh | 34 |
6 files changed, 168 insertions, 25 deletions
| @@ -9,6 +9,10 @@ | |||
| 9 | # C stuff | 9 | # C stuff |
| 10 | *.o | 10 | *.o |
| 11 | 11 | ||
| 12 | # Assembly stuff | ||
| 13 | *.S | ||
| 14 | *.s | ||
| 15 | |||
| 12 | # Windows stuff | 16 | # Windows stuff |
| 13 | *.obj | 17 | *.obj |
| 14 | *.exe | 18 | *.exe |
diff --git a/configure.ac b/configure.ac index 2cc7477..4b3d209 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -14,22 +14,21 @@ CFLAGS="$CFLAGS -Wall -std=gnu99 -g" | |||
| 14 | 14 | ||
| 15 | case $host_os in | 15 | case $host_os in |
| 16 | *darwin*) | 16 | *darwin*) |
| 17 | HOST_OS=darwin; | 17 | HOST_OS=darwin |
| 18 | HOST_ABI=macosx | ||
| 18 | ;; | 19 | ;; |
| 19 | *freebsd*) | 20 | *freebsd*) |
| 20 | HOST_OS=freebsd; | 21 | HOST_OS=freebsd |
| 22 | HOST_ABI=elf | ||
| 21 | AC_SUBST([PROG_LDADD], ['-lthr']) | 23 | AC_SUBST([PROG_LDADD], ['-lthr']) |
| 22 | ;; | 24 | ;; |
| 23 | *linux*) | 25 | *linux*) |
| 24 | HOST_OS=linux; | 26 | HOST_OS=linux |
| 27 | HOST_ABI=elf | ||
| 25 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" | 28 | CFLAGS="$CFLAGS -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_SOURCE -D_GNU_SOURCE" |
| 26 | ;; | 29 | ;; |
| 27 | *solaris*) | ||
| 28 | HOST_OS=solaris; | ||
| 29 | CFLAGS="$CFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP" | ||
| 30 | AC_SUBST([PLATFORM_LDADD], ['-lnsl -lsocket']) | ||
| 31 | ;; | ||
| 32 | *openbsd*) | 30 | *openbsd*) |
| 31 | HOST_ABI=elf | ||
| 33 | AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) | 32 | AC_DEFINE([HAVE_ATTRIBUTE__BOUNDED__], [1], [OpenBSD gcc has bounded]) |
| 34 | ;; | 33 | ;; |
| 35 | *mingw*) | 34 | *mingw*) |
| @@ -37,14 +36,20 @@ case $host_os in | |||
| 37 | CFLAGS="$CFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -DOPENSSL_NO_SPEED -D__USE_MINGW_ANSI_STDIO" | 36 | CFLAGS="$CFLAGS -D_GNU_SOURCE -D_POSIX -D_POSIX_SOURCE -D_REENTRANT -D_POSIX_THREAD_SAFE_FUNCTIONS -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600 -DOPENSSL_NO_SPEED -D__USE_MINGW_ANSI_STDIO" |
| 38 | AC_SUBST([PLATFORM_LDADD], ['-lws2_32']) | 37 | AC_SUBST([PLATFORM_LDADD], ['-lws2_32']) |
| 39 | ;; | 38 | ;; |
| 39 | *solaris*) | ||
| 40 | HOST_OS=solaris | ||
| 41 | HOST_ABI=elf | ||
| 42 | CFLAGS="$CFLAGS -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 -DBSD_COMP" | ||
| 43 | AC_SUBST([PLATFORM_LDADD], ['-lnsl -lsocket']) | ||
| 44 | ;; | ||
| 40 | *) ;; | 45 | *) ;; |
| 41 | esac | 46 | esac |
| 42 | 47 | ||
| 43 | AM_CONDITIONAL(HOST_DARWIN, test x$HOST_OS = xdarwin) | 48 | AM_CONDITIONAL([HOST_DARWIN], [test x$HOST_OS = xdarwin]) |
| 44 | AM_CONDITIONAL(HOST_FREEBSD, test x$HOST_OS = xfreebsd) | 49 | AM_CONDITIONAL([HOST_FREEBSD], [test x$HOST_OS = xfreebsd]) |
| 45 | AM_CONDITIONAL(HOST_LINUX, test x$HOST_OS = xlinux) | 50 | AM_CONDITIONAL([HOST_LINUX], [test x$HOST_OS = xlinux]) |
| 46 | AM_CONDITIONAL(HOST_SOLARIS, test x$HOST_OS = xsolaris) | 51 | AM_CONDITIONAL([HOST_SOLARIS], [test x$HOST_OS = xsolaris]) |
| 47 | AM_CONDITIONAL(HOST_WIN, test x$HOST_OS = xwin) | 52 | AM_CONDITIONAL([HOST_WIN], [test x$HOST_OS = xwin]) |
| 48 | 53 | ||
| 49 | AC_CHECK_FUNC([clock_gettime],, | 54 | AC_CHECK_FUNC([clock_gettime],, |
| 50 | [AC_SEARCH_LIBS([clock_gettime],[rt posix4])]) | 55 | [AC_SEARCH_LIBS([clock_gettime],[rt posix4])]) |
| @@ -52,6 +57,7 @@ AC_CHECK_FUNC([clock_gettime],, | |||
| 52 | AC_CHECK_FUNC([dl_iterate_phdr],, | 57 | AC_CHECK_FUNC([dl_iterate_phdr],, |
| 53 | [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])]) | 58 | [AC_SEARCH_LIBS([dl_iterate_phdr],[dl])]) |
| 54 | 59 | ||
| 60 | AM_PROG_AS | ||
| 55 | AC_PROG_CC | 61 | AC_PROG_CC |
| 56 | AC_PROG_LIBTOOL | 62 | AC_PROG_LIBTOOL |
| 57 | AC_PROG_CC_STDC | 63 | AC_PROG_CC_STDC |
| @@ -134,18 +140,25 @@ fi | |||
| 134 | AC_CHECK_HEADERS([sys/sysctl.h err.h]) | 140 | AC_CHECK_HEADERS([sys/sysctl.h err.h]) |
| 135 | 141 | ||
| 136 | AC_ARG_WITH([openssldir], | 142 | AC_ARG_WITH([openssldir], |
| 137 | AS_HELP_STRING([--with-openssldir], [Set the default openssl directory]), | 143 | AS_HELP_STRING([--with-openssldir], |
| 144 | [Set the default openssl directory]), | ||
| 138 | AC_DEFINE_UNQUOTED(OPENSSLDIR, "$withval") | 145 | AC_DEFINE_UNQUOTED(OPENSSLDIR, "$withval") |
| 139 | ) | 146 | ) |
| 140 | 147 | ||
| 141 | AC_ARG_WITH([enginesdir], | 148 | AC_ARG_WITH([enginesdir], |
| 142 | AS_HELP_STRING([--with-enginesdir], [Set the default engines directory (use with openssldir)]), | 149 | AS_HELP_STRING([--with-enginesdir], |
| 150 | [Set the default engines directory (use with openssldir)]), | ||
| 143 | AC_DEFINE_UNQUOTED(ENGINESDIR, "$withval") | 151 | AC_DEFINE_UNQUOTED(ENGINESDIR, "$withval") |
| 144 | ) | 152 | ) |
| 145 | 153 | ||
| 146 | AC_ARG_ENABLE([asm], | 154 | AC_ARG_ENABLE([asm], |
| 147 | AS_HELP_STRING([--disable-asm], [Disable assembly])) | 155 | AS_HELP_STRING([--disable-asm], [Disable assembly])) |
| 148 | AS_IF([test "x$enable_asm" = "xno"], [CFLAGS="$CFLAGS -DOPENSSL_NO_ASM"]) | 156 | AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"]) |
| 157 | |||
| 158 | AM_CONDITIONAL([HOST_ASM_ELF_X86_64], | ||
| 159 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) | ||
| 160 | AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], | ||
| 161 | [test "x$HOST_ABI" = "xmacosx" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) | ||
| 149 | 162 | ||
| 150 | AC_ARG_ENABLE([libtls], | 163 | AC_ARG_ENABLE([libtls], |
| 151 | AS_HELP_STRING([--enable-libtls], [Enable building the libtls library])) | 164 | AS_HELP_STRING([--enable-libtls], [Enable building the libtls library])) |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 39b143d..91c58db 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
| @@ -10,7 +10,11 @@ EXTRA_DIST = VERSION | |||
| 10 | 10 | ||
| 11 | libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ | 11 | libcrypto_la_LDFLAGS = -version-info @LIBCRYPTO_VERSION@ |
| 12 | libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la | 12 | libcrypto_la_LIBADD = libcompat.la libcompatnoopt.la |
| 13 | libcrypto_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) -DOPENSSL_NO_HW_PADLOCK | 13 | libcrypto_la_CFLAGS = $(CFLAGS) $(USER_CFLAGS) |
| 14 | libcrypto_la_CFLAGS += -DOPENSSL_NO_HW_PADLOCK | ||
| 15 | if OPENSSL_NO_ASM | ||
| 16 | libcrypto_la_CFLAGS += -DOPENSSL_NO_ASM | ||
| 17 | endif | ||
| 14 | 18 | ||
| 15 | noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la | 19 | noinst_LTLIBRARIES = libcompat.la libcompatnoopt.la |
| 16 | 20 | ||
| @@ -103,6 +107,21 @@ noinst_HEADERS += compat/chacha_private.h | |||
| 103 | libcrypto_la_SOURCES = | 107 | libcrypto_la_SOURCES = |
| 104 | EXTRA_libcrypto_la_SOURCES = | 108 | EXTRA_libcrypto_la_SOURCES = |
| 105 | 109 | ||
| 110 | include Makefile.am.elf-x86_64 | ||
| 111 | include Makefile.am.macosx-x86_64 | ||
| 112 | |||
| 113 | if !HOST_ASM_ELF_X86_64 | ||
| 114 | if !HOST_ASM_MACOSX_X86_64 | ||
| 115 | libcrypto_la_SOURCES += aes/aes_cbc.c | ||
| 116 | libcrypto_la_SOURCES += aes/aes_core.c | ||
| 117 | libcrypto_la_SOURCES += camellia/camellia.c | ||
| 118 | libcrypto_la_SOURCES += camellia/cmll_cbc.c | ||
| 119 | libcrypto_la_SOURCES += rc4/rc4_enc.c | ||
| 120 | libcrypto_la_SOURCES += rc4/rc4_skey.c | ||
| 121 | libcrypto_la_SOURCES += whrlpool/wp_block.c | ||
| 122 | endif | ||
| 123 | endif | ||
| 124 | |||
| 106 | libcrypto_la_SOURCES += cpt_err.c | 125 | libcrypto_la_SOURCES += cpt_err.c |
| 107 | libcrypto_la_SOURCES += cryptlib.c | 126 | libcrypto_la_SOURCES += cryptlib.c |
| 108 | libcrypto_la_SOURCES += cversion.c | 127 | libcrypto_la_SOURCES += cversion.c |
| @@ -118,9 +137,7 @@ noinst_HEADERS += md32_common.h | |||
| 118 | noinst_HEADERS += o_time.h | 137 | noinst_HEADERS += o_time.h |
| 119 | 138 | ||
| 120 | # aes | 139 | # aes |
| 121 | libcrypto_la_SOURCES += aes/aes_cbc.c | ||
| 122 | libcrypto_la_SOURCES += aes/aes_cfb.c | 140 | libcrypto_la_SOURCES += aes/aes_cfb.c |
| 123 | libcrypto_la_SOURCES += aes/aes_core.c | ||
| 124 | libcrypto_la_SOURCES += aes/aes_ctr.c | 141 | libcrypto_la_SOURCES += aes/aes_ctr.c |
| 125 | libcrypto_la_SOURCES += aes/aes_ecb.c | 142 | libcrypto_la_SOURCES += aes/aes_ecb.c |
| 126 | libcrypto_la_SOURCES += aes/aes_ige.c | 143 | libcrypto_la_SOURCES += aes/aes_ige.c |
| @@ -284,8 +301,6 @@ libcrypto_la_SOURCES += buffer/buf_str.c | |||
| 284 | libcrypto_la_SOURCES += buffer/buffer.c | 301 | libcrypto_la_SOURCES += buffer/buffer.c |
| 285 | 302 | ||
| 286 | # camellia | 303 | # camellia |
| 287 | libcrypto_la_SOURCES += camellia/camellia.c | ||
| 288 | libcrypto_la_SOURCES += camellia/cmll_cbc.c | ||
| 289 | libcrypto_la_SOURCES += camellia/cmll_cfb.c | 304 | libcrypto_la_SOURCES += camellia/cmll_cfb.c |
| 290 | libcrypto_la_SOURCES += camellia/cmll_ctr.c | 305 | libcrypto_la_SOURCES += camellia/cmll_ctr.c |
| 291 | libcrypto_la_SOURCES += camellia/cmll_ecb.c | 306 | libcrypto_la_SOURCES += camellia/cmll_ecb.c |
| @@ -666,8 +681,6 @@ libcrypto_la_SOURCES += rc2/rc2ofb64.c | |||
| 666 | noinst_HEADERS += rc2/rc2_locl.h | 681 | noinst_HEADERS += rc2/rc2_locl.h |
| 667 | 682 | ||
| 668 | # rc4 | 683 | # rc4 |
| 669 | libcrypto_la_SOURCES += rc4/rc4_enc.c | ||
| 670 | libcrypto_la_SOURCES += rc4/rc4_skey.c | ||
| 671 | noinst_HEADERS += rc4/rc4_locl.h | 684 | noinst_HEADERS += rc4/rc4_locl.h |
| 672 | 685 | ||
| 673 | # ripemd | 686 | # ripemd |
| @@ -739,7 +752,6 @@ libcrypto_la_SOURCES += ui/ui_util.c | |||
| 739 | noinst_HEADERS += ui/ui_locl.h | 752 | noinst_HEADERS += ui/ui_locl.h |
| 740 | 753 | ||
| 741 | # whrlpool | 754 | # whrlpool |
| 742 | libcrypto_la_SOURCES += whrlpool/wp_block.c | ||
| 743 | libcrypto_la_SOURCES += whrlpool/wp_dgst.c | 755 | libcrypto_la_SOURCES += whrlpool/wp_dgst.c |
| 744 | noinst_HEADERS += whrlpool/wp_locl.h | 756 | noinst_HEADERS += whrlpool/wp_locl.h |
| 745 | 757 | ||
diff --git a/crypto/Makefile.am.elf-x86_64 b/crypto/Makefile.am.elf-x86_64 new file mode 100644 index 0000000..6257c40 --- /dev/null +++ b/crypto/Makefile.am.elf-x86_64 | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | |||
| 2 | ASM_X86_64_ELF = aes/aes-elf-x86_64.s | ||
| 3 | ASM_X86_64_ELF += aes/bsaes-elf-x86_64.s | ||
| 4 | ASM_X86_64_ELF += aes/vpaes-elf-x86_64.s | ||
| 5 | ASM_X86_64_ELF += aes/aesni-elf-x86_64.s | ||
| 6 | ASM_X86_64_ELF += aes/aesni-sha1-elf-x86_64.s | ||
| 7 | ASM_X86_64_ELF += bn/modexp512-elf-x86_64.s | ||
| 8 | ASM_X86_64_ELF += bn/mont-elf-x86_64.s | ||
| 9 | ASM_X86_64_ELF += bn/mont5-elf-x86_64.s | ||
| 10 | ASM_X86_64_ELF += bn/gf2m-elf-x86_64.s | ||
| 11 | ASM_X86_64_ELF += camellia/cmll-elf-x86_64.s | ||
| 12 | ASM_X86_64_ELF += md5/md5-elf-x86_64.s | ||
| 13 | ASM_X86_64_ELF += modes/ghash-elf-x86_64.s | ||
| 14 | ASM_X86_64_ELF += rc4/rc4-elf-x86_64.s | ||
| 15 | ASM_X86_64_ELF += rc4/rc4-md5-elf-x86_64.s | ||
| 16 | ASM_X86_64_ELF += sha/sha1-elf-x86_64.s | ||
| 17 | ASM_X86_64_ELF += sha/sha256-elf-x86_64.S | ||
| 18 | ASM_X86_64_ELF += sha/sha512-elf-x86_64.S | ||
| 19 | ASM_X86_64_ELF += whrlpool/wp-elf-x86_64.s | ||
| 20 | ASM_X86_64_ELF += cpuid-elf-x86_64.S | ||
| 21 | |||
| 22 | EXTRA_DIST += $(ASM_X86_64_ELF) | ||
| 23 | |||
| 24 | if HOST_ASM_ELF_X86_64 | ||
| 25 | libcrypto_la_CFLAGS += -DAES_ASM | ||
| 26 | libcrypto_la_CFLAGS += -DBSAES_ASM | ||
| 27 | libcrypto_la_CFLAGS += -DVPAES_ASM | ||
| 28 | libcrypto_la_CFLAGS += -DOPENSSL_IA32_SSE2 | ||
| 29 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_MONT | ||
| 30 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_MONT5 | ||
| 31 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_GF2m | ||
| 32 | libcrypto_la_CFLAGS += -DMD5_ASM | ||
| 33 | libcrypto_la_CFLAGS += -DGHASH_ASM | ||
| 34 | libcrypto_la_CFLAGS += -DRSA_ASM | ||
| 35 | libcrypto_la_CFLAGS += -DSHA1_ASM | ||
| 36 | libcrypto_la_CFLAGS += -DSHA256_ASM | ||
| 37 | libcrypto_la_CFLAGS += -DSHA512_ASM | ||
| 38 | libcrypto_la_CFLAGS += -DWHIRLPOOL_ASM | ||
| 39 | libcrypto_la_CFLAGS += -DOPENSSL_CPUID_OBJ | ||
| 40 | libcrypto_la_SOURCES += $(ASM_X86_64_ELF) | ||
| 41 | endif | ||
diff --git a/crypto/Makefile.am.macosx-x86_64 b/crypto/Makefile.am.macosx-x86_64 new file mode 100644 index 0000000..e361aae --- /dev/null +++ b/crypto/Makefile.am.macosx-x86_64 | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | |||
| 2 | ASM_X86_64_MACOSX = aes/aes-macosx-x86_64.s | ||
| 3 | ASM_X86_64_MACOSX += aes/bsaes-macosx-x86_64.s | ||
| 4 | ASM_X86_64_MACOSX += aes/vpaes-macosx-x86_64.s | ||
| 5 | ASM_X86_64_MACOSX += aes/aesni-macosx-x86_64.s | ||
| 6 | ASM_X86_64_MACOSX += aes/aesni-sha1-macosx-x86_64.s | ||
| 7 | ASM_X86_64_MACOSX += bn/modexp512-macosx-x86_64.s | ||
| 8 | ASM_X86_64_MACOSX += bn/mont-macosx-x86_64.s | ||
| 9 | ASM_X86_64_MACOSX += bn/mont5-macosx-x86_64.s | ||
| 10 | ASM_X86_64_MACOSX += bn/gf2m-macosx-x86_64.s | ||
| 11 | ASM_X86_64_MACOSX += camellia/cmll-macosx-x86_64.s | ||
| 12 | ASM_X86_64_MACOSX += md5/md5-macosx-x86_64.s | ||
| 13 | ASM_X86_64_MACOSX += modes/ghash-macosx-x86_64.s | ||
| 14 | ASM_X86_64_MACOSX += rc4/rc4-macosx-x86_64.s | ||
| 15 | ASM_X86_64_MACOSX += rc4/rc4-md5-macosx-x86_64.s | ||
| 16 | ASM_X86_64_MACOSX += sha/sha1-macosx-x86_64.s | ||
| 17 | ASM_X86_64_MACOSX += sha/sha256-macosx-x86_64.S | ||
| 18 | ASM_X86_64_MACOSX += sha/sha512-macosx-x86_64.S | ||
| 19 | ASM_X86_64_MACOSX += whrlpool/wp-macosx-x86_64.s | ||
| 20 | ASM_X86_64_MACOSX += cpuid-macosx-x86_64.S | ||
| 21 | |||
| 22 | EXTRA_DIST += $(ASM_X86_64_MACOSX) | ||
| 23 | |||
| 24 | if HOST_ASM_MACOSX_X86_64 | ||
| 25 | libcrypto_la_CFLAGS += -DAES_ASM | ||
| 26 | libcrypto_la_CFLAGS += -DBSAES_ASM | ||
| 27 | libcrypto_la_CFLAGS += -DVPAES_ASM | ||
| 28 | libcrypto_la_CFLAGS += -DOPENSSL_IA32_SSE2 | ||
| 29 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_MONT | ||
| 30 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_MONT5 | ||
| 31 | libcrypto_la_CFLAGS += -DOPENSSL_BN_ASM_GF2m | ||
| 32 | libcrypto_la_CFLAGS += -DMD5_ASM | ||
| 33 | libcrypto_la_CFLAGS += -DGHASH_ASM | ||
| 34 | libcrypto_la_CFLAGS += -DRSA_ASM | ||
| 35 | libcrypto_la_CFLAGS += -DSHA1_ASM | ||
| 36 | libcrypto_la_CFLAGS += -DSHA256_ASM | ||
| 37 | libcrypto_la_CFLAGS += -DSHA512_ASM | ||
| 38 | libcrypto_la_CFLAGS += -DWHIRLPOOL_ASM | ||
| 39 | libcrypto_la_CFLAGS += -DOPENSSL_CPUID_OBJ | ||
| 40 | libcrypto_la_SOURCES += $(ASM_X86_64_MACOSX) | ||
| 41 | endif | ||
| @@ -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 |
