diff options
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | crypto/Makefile.am | 16 | ||||
-rw-r--r-- | crypto/Makefile.am.elf-mips | 24 | ||||
-rw-r--r-- | crypto/Makefile.am.elf-mips64 | 24 | ||||
-rw-r--r-- | crypto/bn/arch/mips/bn_arch.h | 24 | ||||
-rw-r--r-- | include/arch/mips/opensslconf.h | 154 | ||||
-rwxr-xr-x | scripts/test | 17 | ||||
-rwxr-xr-x | update.sh | 97 |
8 files changed, 327 insertions, 44 deletions
diff --git a/configure.ac b/configure.ac index f3d7c77..51e096b 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -77,9 +77,9 @@ AS_CASE([$host_cpu], | |||
77 | [arm64], [host_cpu=aarch64], | 77 | [arm64], [host_cpu=aarch64], |
78 | [*arm*], [host_cpu=arm], | 78 | [*arm*], [host_cpu=arm], |
79 | [*amd64*], [host_cpu=x86_64 HOSTARCH=intel], | 79 | [*amd64*], [host_cpu=x86_64 HOSTARCH=intel], |
80 | [i?86], [host_cpu=i386 HOSTARCH=intel], | 80 | [i?86], [host_cpu=i386 HOSTARCH=intel enable_asm=no], |
81 | [mipsel*], [host_cpu=mips], | 81 | [mips64*], [host_cpu=mips64 enable_asm=no], |
82 | [mips64el*], [host_cpu=mips64], | 82 | [mips*], [host_cpu=mips enable_asm=no], |
83 | [powerpc*], [host_cpu=powerpc], | 83 | [powerpc*], [host_cpu=powerpc], |
84 | [ppc64*], [host_cpu=powerpc64], | 84 | [ppc64*], [host_cpu=powerpc64], |
85 | [x86_64], [HOSTARCH=intel] | 85 | [x86_64], [HOSTARCH=intel] |
@@ -109,13 +109,16 @@ int main() {return 0;} | |||
109 | AC_MSG_RESULT(no) | 109 | AC_MSG_RESULT(no) |
110 | ]) | 110 | ]) |
111 | 111 | ||
112 | AC_ARG_ENABLE([asm], | 112 | AC_ARG_ENABLE([asm], AS_HELP_STRING([--disable-asm], [Disable assembly])) |
113 | AS_HELP_STRING([--disable-asm], [Disable assembly])) | 113 | AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno"]) |
114 | AM_CONDITIONAL([OPENSSL_NO_ASM], [test "x$enable_asm" = "xno" -o "$host_cpu" = "i386"]) | ||
115 | 114 | ||
116 | # Conditionally enable assembly by default | 115 | # Conditionally enable assembly by default |
117 | AM_CONDITIONAL([HOST_ASM_ELF_ARM], | 116 | AM_CONDITIONAL([HOST_ASM_ELF_ARM], |
118 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "arm" -a "x$enable_asm" != "xno"]) | 117 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "arm" -a "x$enable_asm" != "xno"]) |
118 | AM_CONDITIONAL([HOST_ASM_ELF_MIPS], | ||
119 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "mips" -a "x$enable_asm" != "xno"]) | ||
120 | AM_CONDITIONAL([HOST_ASM_ELF_MIPS64], | ||
121 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "mips64" -a "x$enable_asm" != "xno"]) | ||
119 | AM_CONDITIONAL([HOST_ASM_ELF_X86_64], | 122 | AM_CONDITIONAL([HOST_ASM_ELF_X86_64], |
120 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) | 123 | [test "x$HOST_ABI" = "xelf" -a "$host_cpu" = "x86_64" -a "x$enable_asm" != "xno"]) |
121 | AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], | 124 | AM_CONDITIONAL([HOST_ASM_MACOSX_X86_64], |
diff --git a/crypto/Makefile.am b/crypto/Makefile.am index e456198..3939802 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am | |||
@@ -136,10 +136,6 @@ endif | |||
136 | libcrypto_la_CPPFLAGS = -I$(top_srcdir)/crypto/hidden ${AM_CPPFLAGS} | 136 | libcrypto_la_CPPFLAGS = -I$(top_srcdir)/crypto/hidden ${AM_CPPFLAGS} |
137 | libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL | 137 | libcrypto_la_CPPFLAGS += -DLIBRESSL_INTERNAL |
138 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK | 138 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_HW_PADLOCK |
139 | if OPENSSL_NO_ASM | ||
140 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM | ||
141 | else | ||
142 | endif | ||
143 | 139 | ||
144 | if OPENSSLDIR_DEFINED | 140 | if OPENSSLDIR_DEFINED |
145 | libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"@OPENSSLDIR@\" | 141 | libcrypto_la_CPPFLAGS += -DOPENSSLDIR=\"@OPENSSLDIR@\" |
@@ -247,16 +243,21 @@ libcrypto_la_SOURCES = | |||
247 | EXTRA_libcrypto_la_SOURCES = | 243 | EXTRA_libcrypto_la_SOURCES = |
248 | 244 | ||
249 | include Makefile.am.elf-arm | 245 | include Makefile.am.elf-arm |
246 | include Makefile.am.elf-mips | ||
247 | include Makefile.am.elf-mips64 | ||
250 | include Makefile.am.elf-x86_64 | 248 | include Makefile.am.elf-x86_64 |
251 | include Makefile.am.macosx-x86_64 | 249 | include Makefile.am.macosx-x86_64 |
252 | include Makefile.am.masm-x86_64 | 250 | include Makefile.am.masm-x86_64 |
253 | include Makefile.am.mingw64-x86_64 | 251 | include Makefile.am.mingw64-x86_64 |
254 | 252 | ||
255 | if !HOST_ASM_ELF_ARM | 253 | if !HOST_ASM_ELF_ARM |
254 | if !HOST_ASM_ELF_MIPS | ||
255 | if !HOST_ASM_ELF_MIPS64 | ||
256 | if !HOST_ASM_ELF_X86_64 | 256 | if !HOST_ASM_ELF_X86_64 |
257 | if !HOST_ASM_MACOSX_X86_64 | 257 | if !HOST_ASM_MACOSX_X86_64 |
258 | if !HOST_ASM_MASM_X86_64 | 258 | if !HOST_ASM_MASM_X86_64 |
259 | if !HOST_ASM_MINGW64_X86_64 | 259 | if !HOST_ASM_MINGW64_X86_64 |
260 | libcrypto_la_CPPFLAGS += -DOPENSSL_NO_ASM | ||
260 | libcrypto_la_SOURCES += aes/aes_cbc.c | 261 | libcrypto_la_SOURCES += aes/aes_cbc.c |
261 | libcrypto_la_SOURCES += aes/aes_core.c | 262 | libcrypto_la_SOURCES += aes/aes_core.c |
262 | libcrypto_la_SOURCES += camellia/camellia.c | 263 | libcrypto_la_SOURCES += camellia/camellia.c |
@@ -269,6 +270,8 @@ endif | |||
269 | endif | 270 | endif |
270 | endif | 271 | endif |
271 | endif | 272 | endif |
273 | endif | ||
274 | endif | ||
272 | 275 | ||
273 | libcrypto_la_SOURCES += cpt_err.c | 276 | libcrypto_la_SOURCES += cpt_err.c |
274 | libcrypto_la_SOURCES += cryptlib.c | 277 | libcrypto_la_SOURCES += cryptlib.c |
@@ -459,6 +462,11 @@ libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/bn/arch/i386/ | |||
459 | endif | 462 | endif |
460 | noinst_HEADERS += bn/arch/i386/bn_arch.h | 463 | noinst_HEADERS += bn/arch/i386/bn_arch.h |
461 | 464 | ||
465 | if HOST_MIPS | ||
466 | libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/bn/arch/mips/ | ||
467 | endif | ||
468 | noinst_HEADERS += bn/arch/mips/bn_arch.h | ||
469 | |||
462 | if HOST_MIPS64 | 470 | if HOST_MIPS64 |
463 | libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/bn/arch/mips64/ | 471 | libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/bn/arch/mips64/ |
464 | endif | 472 | endif |
diff --git a/crypto/Makefile.am.elf-mips b/crypto/Makefile.am.elf-mips new file mode 100644 index 0000000..9c4a70f --- /dev/null +++ b/crypto/Makefile.am.elf-mips | |||
@@ -0,0 +1,24 @@ | |||
1 | ASM_MIPS_ELF = aes/aes-mips.S | ||
2 | ASM_MIPS_ELF += bn/bn-mips.S | ||
3 | ASM_MIPS_ELF += bn/mont-mips.S | ||
4 | ASM_MIPS_ELF += sha/sha1-mips.S | ||
5 | ASM_MIPS_ELF += sha/sha512-mips.S | ||
6 | ASM_MIPS_ELF += sha/sha256-mips.S | ||
7 | |||
8 | ASM_MIPS_ELF += aes/aes_cbc.c | ||
9 | ASM_MIPS_ELF += camellia/camellia.c | ||
10 | ASM_MIPS_ELF += camellia/cmll_cbc.c | ||
11 | ASM_MIPS_ELF += rc4/rc4_enc.c | ||
12 | ASM_MIPS_ELF += rc4/rc4_skey.c | ||
13 | ASM_MIPS_ELF += whrlpool/wp_block.c | ||
14 | |||
15 | EXTRA_DIST += $(ASM_MIPS_ELF) | ||
16 | |||
17 | if HOST_ASM_ELF_MIPS | ||
18 | libcrypto_la_CPPFLAGS += -DAES_ASM | ||
19 | libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT | ||
20 | libcrypto_la_CPPFLAGS += -DSHA1_ASM | ||
21 | libcrypto_la_CPPFLAGS += -DSHA256_ASM | ||
22 | libcrypto_la_CPPFLAGS += -DSHA512_ASM | ||
23 | libcrypto_la_SOURCES += $(ASM_MIPS_ELF) | ||
24 | endif | ||
diff --git a/crypto/Makefile.am.elf-mips64 b/crypto/Makefile.am.elf-mips64 new file mode 100644 index 0000000..c599fa8 --- /dev/null +++ b/crypto/Makefile.am.elf-mips64 | |||
@@ -0,0 +1,24 @@ | |||
1 | ASM_MIPS64_ELF = aes/aes-mips.S | ||
2 | ASM_MIPS64_ELF += bn/bn-mips.S | ||
3 | ASM_MIPS64_ELF += bn/mont-mips.S | ||
4 | ASM_MIPS64_ELF += sha/sha1-mips.S | ||
5 | ASM_MIPS64_ELF += sha/sha512-mips.S | ||
6 | ASM_MIPS64_ELF += sha/sha256-mips.S | ||
7 | |||
8 | ASM_MIPS64_ELF += aes/aes_cbc.c | ||
9 | ASM_MIPS64_ELF += camellia/camellia.c | ||
10 | ASM_MIPS64_ELF += camellia/cmll_cbc.c | ||
11 | ASM_MIPS64_ELF += rc4/rc4_enc.c | ||
12 | ASM_MIPS64_ELF += rc4/rc4_skey.c | ||
13 | ASM_MIPS64_ELF += whrlpool/wp_block.c | ||
14 | |||
15 | EXTRA_DIST += $(ASM_MIPS64_ELF) | ||
16 | |||
17 | if HOST_ASM_ELF_MIPS64 | ||
18 | libcrypto_la_CPPFLAGS += -DAES_ASM | ||
19 | libcrypto_la_CPPFLAGS += -DOPENSSL_BN_ASM_MONT | ||
20 | libcrypto_la_CPPFLAGS += -DSHA1_ASM | ||
21 | libcrypto_la_CPPFLAGS += -DSHA256_ASM | ||
22 | libcrypto_la_CPPFLAGS += -DSHA512_ASM | ||
23 | libcrypto_la_SOURCES += $(ASM_MIPS64_ELF) | ||
24 | endif | ||
diff --git a/crypto/bn/arch/mips/bn_arch.h b/crypto/bn/arch/mips/bn_arch.h new file mode 100644 index 0000000..4d6571f --- /dev/null +++ b/crypto/bn/arch/mips/bn_arch.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* $OpenBSD: bn_arch.h,v 1.1 2023/01/20 10:04:34 jsing Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #ifndef HEADER_BN_ARCH_H | ||
19 | #define HEADER_BN_ARCH_H | ||
20 | |||
21 | #ifndef OPENSSL_NO_ASM | ||
22 | |||
23 | #endif | ||
24 | #endif | ||
diff --git a/include/arch/mips/opensslconf.h b/include/arch/mips/opensslconf.h new file mode 100644 index 0000000..f17d3d2 --- /dev/null +++ b/include/arch/mips/opensslconf.h | |||
@@ -0,0 +1,154 @@ | |||
1 | #include <openssl/opensslfeatures.h> | ||
2 | /* crypto/opensslconf.h.in */ | ||
3 | |||
4 | #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) | ||
5 | #define OPENSSLDIR "/etc/ssl" | ||
6 | #endif | ||
7 | |||
8 | #undef OPENSSL_UNISTD | ||
9 | #define OPENSSL_UNISTD <unistd.h> | ||
10 | |||
11 | #undef OPENSSL_EXPORT_VAR_AS_FUNCTION | ||
12 | |||
13 | #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) | ||
14 | #define IDEA_INT unsigned int | ||
15 | #endif | ||
16 | |||
17 | #if defined(HEADER_MD2_H) && !defined(MD2_INT) | ||
18 | #define MD2_INT unsigned int | ||
19 | #endif | ||
20 | |||
21 | #if defined(HEADER_RC2_H) && !defined(RC2_INT) | ||
22 | /* I need to put in a mod for the alpha - eay */ | ||
23 | #define RC2_INT unsigned int | ||
24 | #endif | ||
25 | |||
26 | #if defined(HEADER_RC4_H) | ||
27 | #if !defined(RC4_INT) | ||
28 | /* using int types make the structure larger but make the code faster | ||
29 | * on most boxes I have tested - up to %20 faster. */ | ||
30 | /* | ||
31 | * I don't know what does "most" mean, but declaring "int" is a must on: | ||
32 | * - Intel P6 because partial register stalls are very expensive; | ||
33 | * - elder Alpha because it lacks byte load/store instructions; | ||
34 | */ | ||
35 | #define RC4_INT unsigned int | ||
36 | #endif | ||
37 | #if !defined(RC4_CHUNK) | ||
38 | /* | ||
39 | * This enables code handling data aligned at natural CPU word | ||
40 | * boundary. See crypto/rc4/rc4_enc.c for further details. | ||
41 | */ | ||
42 | #undef RC4_CHUNK | ||
43 | #endif | ||
44 | #endif | ||
45 | |||
46 | #if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) | ||
47 | /* If this is set to 'unsigned int' on a DEC Alpha, this gives about a | ||
48 | * %20 speed up (longs are 8 bytes, int's are 4). */ | ||
49 | #ifndef DES_LONG | ||
50 | #define DES_LONG unsigned int | ||
51 | #endif | ||
52 | #endif | ||
53 | |||
54 | #if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) | ||
55 | #define CONFIG_HEADER_BN_H | ||
56 | #define BN_LLONG | ||
57 | |||
58 | /* Should we define BN_DIV2W here? */ | ||
59 | |||
60 | /* Only one for the following should be defined */ | ||
61 | /* The prime number generation stuff may not work when | ||
62 | * EIGHT_BIT but I don't care since I've only used this mode | ||
63 | * for debugging the bignum libraries */ | ||
64 | #undef SIXTY_FOUR_BIT_LONG | ||
65 | #undef SIXTY_FOUR_BIT | ||
66 | #define THIRTY_TWO_BIT | ||
67 | #undef SIXTEEN_BIT | ||
68 | #undef EIGHT_BIT | ||
69 | #endif | ||
70 | |||
71 | #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) | ||
72 | #define CONFIG_HEADER_RC4_LOCL_H | ||
73 | /* if this is defined data[i] is used instead of *data, this is a %20 | ||
74 | * speedup on x86 */ | ||
75 | #define RC4_INDEX | ||
76 | #endif | ||
77 | |||
78 | #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) | ||
79 | #define CONFIG_HEADER_BF_LOCL_H | ||
80 | #undef BF_PTR | ||
81 | #endif /* HEADER_BF_LOCL_H */ | ||
82 | |||
83 | #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) | ||
84 | #define CONFIG_HEADER_DES_LOCL_H | ||
85 | #ifndef DES_DEFAULT_OPTIONS | ||
86 | /* the following is tweaked from a config script, that is why it is a | ||
87 | * protected undef/define */ | ||
88 | #ifndef DES_PTR | ||
89 | #undef DES_PTR | ||
90 | #endif | ||
91 | |||
92 | /* This helps C compiler generate the correct code for multiple functional | ||
93 | * units. It reduces register dependencies at the expense of 2 more | ||
94 | * registers */ | ||
95 | #ifndef DES_RISC1 | ||
96 | #undef DES_RISC1 | ||
97 | #endif | ||
98 | |||
99 | #ifndef DES_RISC2 | ||
100 | #undef DES_RISC2 | ||
101 | #endif | ||
102 | |||
103 | #if defined(DES_RISC1) && defined(DES_RISC2) | ||
104 | YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! | ||
105 | #endif | ||
106 | |||
107 | /* Unroll the inner loop, this sometimes helps, sometimes hinders. | ||
108 | * Very much CPU dependent */ | ||
109 | #ifndef DES_UNROLL | ||
110 | #define DES_UNROLL | ||
111 | #endif | ||
112 | |||
113 | /* These default values were supplied by | ||
114 | * Peter Gutman <pgut001@cs.auckland.ac.nz> | ||
115 | * They are only used if nothing else has been defined */ | ||
116 | #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) | ||
117 | /* Special defines which change the way the code is built depending on the | ||
118 | CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find | ||
119 | even newer MIPS CPU's, but at the moment one size fits all for | ||
120 | optimization options. Older Sparc's work better with only UNROLL, but | ||
121 | there's no way to tell at compile time what it is you're running on */ | ||
122 | |||
123 | #if defined( sun ) /* Newer Sparc's */ | ||
124 | # define DES_PTR | ||
125 | # define DES_RISC1 | ||
126 | # define DES_UNROLL | ||
127 | #elif defined( __ultrix ) /* Older MIPS */ | ||
128 | # define DES_PTR | ||
129 | # define DES_RISC2 | ||
130 | # define DES_UNROLL | ||
131 | #elif defined( __osf1__ ) /* Alpha */ | ||
132 | # define DES_PTR | ||
133 | # define DES_RISC2 | ||
134 | #elif defined ( _AIX ) /* RS6000 */ | ||
135 | /* Unknown */ | ||
136 | #elif defined( __hpux ) /* HP-PA */ | ||
137 | /* Unknown */ | ||
138 | #elif defined( __aux ) /* 68K */ | ||
139 | /* Unknown */ | ||
140 | #elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ | ||
141 | # define DES_UNROLL | ||
142 | #elif defined( __sgi ) /* Newer MIPS */ | ||
143 | # define DES_PTR | ||
144 | # define DES_RISC2 | ||
145 | # define DES_UNROLL | ||
146 | #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ | ||
147 | # define DES_PTR | ||
148 | # define DES_RISC1 | ||
149 | # define DES_UNROLL | ||
150 | #endif /* Systems-specific speed defines */ | ||
151 | #endif | ||
152 | |||
153 | #endif /* DES_DEFAULT_OPTIONS */ | ||
154 | #endif /* HEADER_DES_LOCL_H */ | ||
diff --git a/scripts/test b/scripts/test index 0eb2c06..3443702 100755 --- a/scripts/test +++ b/scripts/test | |||
@@ -89,6 +89,23 @@ elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then | |||
89 | 89 | ||
90 | file apps/openssl/.libs/openssl | 90 | file apps/openssl/.libs/openssl |
91 | 91 | ||
92 | elif [ "x$ARCH" = "xmipsel" -o "x$ARCH" = "xmips64el" ]; then | ||
93 | sudo apt-get install -y qemu-user-static binfmt-support | ||
94 | |||
95 | if [ "x$ARCH" = "xmipsel" ]; then | ||
96 | sudo apt-get install -y g++-mips-linux-gnu | ||
97 | sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/ | ||
98 | ./configure --host=mipsel-linux-gnu | ||
99 | LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib make -j 4 check | ||
100 | else | ||
101 | sudo apt-get install -y g++-mips64el-linux-gnuabi64 | ||
102 | sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64 | ||
103 | ./configure --host=mips64el-linux-gnuabi64 | ||
104 | LD_LIBRARY_PATH=/usr/mips64el-linux-gnuabi64/lib make -j 4 check | ||
105 | fi | ||
106 | |||
107 | file apps/openssl/.libs/openssl | ||
108 | |||
92 | elif [ "x$ARCH" = "xandroid" ]; then | 109 | elif [ "x$ARCH" = "xandroid" ]; then |
93 | export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake | 110 | export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake |
94 | 111 | ||
@@ -180,65 +180,94 @@ fixup_masm() { | |||
180 | # generate assembly crypto algorithms | 180 | # generate assembly crypto algorithms |
181 | asm_src=$libcrypto_src | 181 | asm_src=$libcrypto_src |
182 | gen_asm_stdout() { | 182 | gen_asm_stdout() { |
183 | CC=true perl $asm_src/$2 $1 > $3.tmp | 183 | CC=true perl $asm_src/$2 $1 > crypto/$3.tmp |
184 | [ $1 = "elf" ] && cat <<-EOF >> $3.tmp | 184 | [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp |
185 | #if defined(HAVE_GNU_STACK) | 185 | #if defined(HAVE_GNU_STACK) |
186 | .section .note.GNU-stack,"",%progbits | 186 | .section .note.GNU-stack,"",%progbits |
187 | #endif | 187 | #endif |
188 | EOF | 188 | EOF |
189 | if [ $1 = "masm" ]; then | 189 | if [ $1 = "masm" ]; then |
190 | fixup_masm $3.tmp $3 | 190 | fixup_masm crypto/$3.tmp crypto/$3 |
191 | else | 191 | else |
192 | $MV $3.tmp $3 | 192 | $MV crypto/$3.tmp crypto/$3 |
193 | fi | 193 | fi |
194 | } | 194 | } |
195 | gen_asm_mips() { | ||
196 | abi=$1 | ||
197 | dir=$2 | ||
198 | src=$3 | ||
199 | dst=$4 | ||
200 | CC=true perl $asm_src/$dir/asm/$src.pl $abi $dst.S | ||
201 | cat <<-EOF >> $dst.S | ||
202 | #if defined(HAVE_GNU_STACK) | ||
203 | .section .note.GNU-stack,"",%progbits | ||
204 | #endif | ||
205 | EOF | ||
206 | mv $dst.S crypto/$dir/$dst.S | ||
207 | } | ||
195 | gen_asm() { | 208 | gen_asm() { |
196 | CC=true perl $asm_src/$2 $1 $3.tmp | 209 | CC=true perl $asm_src/$2 $1 crypto/$3.tmp |
197 | [ $1 = "elf" ] && cat <<-EOF >> $3.tmp | 210 | [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp |
198 | #if defined(HAVE_GNU_STACK) | 211 | #if defined(HAVE_GNU_STACK) |
199 | .section .note.GNU-stack,"",%progbits | 212 | .section .note.GNU-stack,"",%progbits |
200 | #endif | 213 | #endif |
201 | EOF | 214 | EOF |
202 | if [ $1 = "masm" ]; then | 215 | if [ $1 = "masm" ]; then |
203 | fixup_masm $3.tmp $3 | 216 | fixup_masm crypto/$3.tmp crypto/$3 |
204 | else | 217 | else |
205 | $MV $3.tmp $3 | 218 | $MV crypto/$3.tmp crypto/$3 |
206 | fi | 219 | fi |
207 | } | 220 | } |
208 | 221 | ||
222 | #echo generating mips ASM source for elf | ||
223 | gen_asm_mips o32 aes aes-mips aes-mips | ||
224 | gen_asm_mips o32 bn mips bn-mips | ||
225 | gen_asm_mips o32 bn mips-mont mont-mips | ||
226 | gen_asm_mips o32 sha sha1-mips sha1-mips | ||
227 | gen_asm_mips o32 sha sha512-mips sha256-mips | ||
228 | gen_asm_mips o32 sha sha512-mips sha512-mips | ||
229 | |||
230 | echo generating mips64 ASM source for elf | ||
231 | gen_asm_mips 64 aes aes-mips aes-mips64 | ||
232 | gen_asm_mips 64 bn mips bn-mips64 | ||
233 | gen_asm_mips 64 bn mips-mont mont-mips64 | ||
234 | gen_asm_mips 64 sha sha1-mips sha1-mips64 | ||
235 | gen_asm_mips 64 sha sha512-mips sha256-mips64 | ||
236 | gen_asm_mips 64 sha sha512-mips sha512-mips64 | ||
237 | |||
209 | echo generating arm ASM source for elf | 238 | echo generating arm ASM source for elf |
210 | gen_asm_stdout elf aes/asm/aes-armv4.pl crypto/aes/aes-elf-armv4.S | 239 | gen_asm_stdout elf aes/asm/aes-armv4.pl aes/aes-elf-armv4.S |
211 | gen_asm_stdout elf bn/asm/armv4-gf2m.pl crypto/bn/gf2m-elf-armv4.S | 240 | gen_asm_stdout elf bn/asm/armv4-gf2m.pl bn/gf2m-elf-armv4.S |
212 | gen_asm_stdout elf bn/asm/armv4-mont.pl crypto/bn/mont-elf-armv4.S | 241 | gen_asm_stdout elf bn/asm/armv4-mont.pl bn/mont-elf-armv4.S |
213 | gen_asm_stdout elf sha/asm/sha1-armv4-large.pl crypto/sha/sha1-elf-armv4.S | 242 | gen_asm_stdout elf sha/asm/sha1-armv4-large.pl sha/sha1-elf-armv4.S |
214 | gen_asm_stdout elf sha/asm/sha256-armv4.pl crypto/sha/sha256-elf-armv4.S | 243 | gen_asm_stdout elf sha/asm/sha256-armv4.pl sha/sha256-elf-armv4.S |
215 | gen_asm_stdout elf sha/asm/sha512-armv4.pl crypto/sha/sha512-elf-armv4.S | 244 | gen_asm_stdout elf sha/asm/sha512-armv4.pl sha/sha512-elf-armv4.S |
216 | gen_asm_stdout elf modes/asm/ghash-armv4.pl crypto/modes/ghash-elf-armv4.S | 245 | gen_asm_stdout elf modes/asm/ghash-armv4.pl modes/ghash-elf-armv4.S |
217 | $CP $libcrypto_src/arch/arm/armv4cpuid.S crypto | 246 | $CP $libcrypto_src/arch/arm/armv4cpuid.S crypto |
218 | $CP $libcrypto_src/arch/arm/armcap.c crypto | 247 | $CP $libcrypto_src/arch/arm/armcap.c crypto |
219 | $CP $libcrypto_src/arch/arm/arm_arch.h crypto | 248 | $CP $libcrypto_src/arch/arm/arm_arch.h crypto |
220 | 249 | ||
221 | for abi in elf macosx masm mingw64; do | 250 | for abi in elf macosx masm mingw64; do |
222 | echo generating x86_64 ASM source for $abi | 251 | echo generating x86_64 ASM source for $abi |
223 | gen_asm_stdout $abi aes/asm/aes-x86_64.pl crypto/aes/aes-$abi-x86_64.S | 252 | gen_asm_stdout $abi aes/asm/aes-x86_64.pl aes/aes-$abi-x86_64.S |
224 | gen_asm_stdout $abi aes/asm/vpaes-x86_64.pl crypto/aes/vpaes-$abi-x86_64.S | 253 | gen_asm_stdout $abi aes/asm/vpaes-x86_64.pl aes/vpaes-$abi-x86_64.S |
225 | gen_asm_stdout $abi aes/asm/bsaes-x86_64.pl crypto/aes/bsaes-$abi-x86_64.S | 254 | gen_asm_stdout $abi aes/asm/bsaes-x86_64.pl aes/bsaes-$abi-x86_64.S |
226 | gen_asm_stdout $abi aes/asm/aesni-x86_64.pl crypto/aes/aesni-$abi-x86_64.S | 255 | gen_asm_stdout $abi aes/asm/aesni-x86_64.pl aes/aesni-$abi-x86_64.S |
227 | gen_asm_stdout $abi aes/asm/aesni-sha1-x86_64.pl crypto/aes/aesni-sha1-$abi-x86_64.S | 256 | gen_asm_stdout $abi aes/asm/aesni-sha1-x86_64.pl aes/aesni-sha1-$abi-x86_64.S |
228 | gen_asm_stdout $abi bn/asm/modexp512-x86_64.pl crypto/bn/modexp512-$abi-x86_64.S | 257 | gen_asm_stdout $abi bn/asm/modexp512-x86_64.pl bn/modexp512-$abi-x86_64.S |
229 | gen_asm_stdout $abi bn/asm/x86_64-mont.pl crypto/bn/mont-$abi-x86_64.S | 258 | gen_asm_stdout $abi bn/asm/x86_64-mont.pl bn/mont-$abi-x86_64.S |
230 | gen_asm_stdout $abi bn/asm/x86_64-mont5.pl crypto/bn/mont5-$abi-x86_64.S | 259 | gen_asm_stdout $abi bn/asm/x86_64-mont5.pl bn/mont5-$abi-x86_64.S |
231 | gen_asm_stdout $abi bn/asm/x86_64-gf2m.pl crypto/bn/gf2m-$abi-x86_64.S | 260 | gen_asm_stdout $abi bn/asm/x86_64-gf2m.pl bn/gf2m-$abi-x86_64.S |
232 | gen_asm_stdout $abi camellia/asm/cmll-x86_64.pl crypto/camellia/cmll-$abi-x86_64.S | 261 | gen_asm_stdout $abi camellia/asm/cmll-x86_64.pl camellia/cmll-$abi-x86_64.S |
233 | gen_asm_stdout $abi md5/asm/md5-x86_64.pl crypto/md5/md5-$abi-x86_64.S | 262 | gen_asm_stdout $abi md5/asm/md5-x86_64.pl md5/md5-$abi-x86_64.S |
234 | gen_asm_stdout $abi modes/asm/ghash-x86_64.pl crypto/modes/ghash-$abi-x86_64.S | 263 | gen_asm_stdout $abi modes/asm/ghash-x86_64.pl modes/ghash-$abi-x86_64.S |
235 | gen_asm_stdout $abi rc4/asm/rc4-x86_64.pl crypto/rc4/rc4-$abi-x86_64.S | 264 | gen_asm_stdout $abi rc4/asm/rc4-x86_64.pl rc4/rc4-$abi-x86_64.S |
236 | gen_asm_stdout $abi rc4/asm/rc4-md5-x86_64.pl crypto/rc4/rc4-md5-$abi-x86_64.S | 265 | gen_asm_stdout $abi rc4/asm/rc4-md5-x86_64.pl rc4/rc4-md5-$abi-x86_64.S |
237 | gen_asm_stdout $abi sha/asm/sha1-x86_64.pl crypto/sha/sha1-$abi-x86_64.S | 266 | gen_asm_stdout $abi sha/asm/sha1-x86_64.pl sha/sha1-$abi-x86_64.S |
238 | gen_asm $abi sha/asm/sha512-x86_64.pl crypto/sha/sha256-$abi-x86_64.S | 267 | gen_asm $abi sha/asm/sha512-x86_64.pl sha/sha256-$abi-x86_64.S |
239 | gen_asm $abi sha/asm/sha512-x86_64.pl crypto/sha/sha512-$abi-x86_64.S | 268 | gen_asm $abi sha/asm/sha512-x86_64.pl sha/sha512-$abi-x86_64.S |
240 | gen_asm_stdout $abi whrlpool/asm/wp-x86_64.pl crypto/whrlpool/wp-$abi-x86_64.S | 269 | gen_asm_stdout $abi whrlpool/asm/wp-x86_64.pl whrlpool/wp-$abi-x86_64.S |
241 | gen_asm $abi x86_64cpuid.pl crypto/cpuid-$abi-x86_64.S | 270 | gen_asm $abi x86_64cpuid.pl cpuid-$abi-x86_64.S |
242 | done | 271 | done |
243 | 272 | ||
244 | # copy libtls source | 273 | # copy libtls source |