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 /crypto | |
| 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 'crypto')
| -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 |
3 files changed, 102 insertions, 8 deletions
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 | ||
