aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenjiro Nakayama <nakayamakenjiro@gmail.com>2026-08-22 11:06:51 +0900
committerKenjiro Nakayama <nakayamakenjiro@gmail.com>2026-08-29 20:38:08 +0900
commita764ec929eec2abdedd76cb5b593c8ec6a6abcfd (patch)
tree127b3092bc42da2abc09ee9b93f276e6358db3a0
parent0ac0850a98ea4c5ccc9f9eb4c6d540409346a1b5 (diff)
downloadportable-a764ec929eec2abdedd76cb5b593c8ec6a6abcfd.tar.gz
portable-a764ec929eec2abdedd76cb5b593c8ec6a6abcfd.tar.bz2
portable-a764ec929eec2abdedd76cb5b593c8ec6a6abcfd.zip
Enable supported MIPS32 assembly in CI
Use the little endian MIPS32 toolchain since the generated assembly is little-endian, and define the architecture feature macros needed to select the AES, BN, SHA-1, and SHA-256 assembly implementations. Do not generate or build SHA-512 assembly for MIPS32. The generator accepts the O32 ABI, but the resulting implementation still uses 64-bit instructions and requires the MIPS64 ISA. It is therefore not valid for generic MIPS32 targets.
-rw-r--r--.github/workflows/linux.yml2
-rw-r--r--configure.ac2
-rw-r--r--crypto/Makefile.am.elf-mips1
-rw-r--r--crypto/arch/mips/crypto_arch.h18
-rw-r--r--crypto/bn/arch/mips/bn_arch.h19
-rwxr-xr-xscripts/test9
-rwxr-xr-xupdate.sh1
7 files changed, 44 insertions, 8 deletions
diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml
index a2a85e7..06dda17 100644
--- a/.github/workflows/linux.yml
+++ b/.github/workflows/linux.yml
@@ -68,7 +68,7 @@ jobs:
68 packages+=(qemu-user-static binfmt-support g++-14-loongarch64-linux-gnu) 68 packages+=(qemu-user-static binfmt-support g++-14-loongarch64-linux-gnu)
69 ;; 69 ;;
70 mips32) 70 mips32)
71 packages+=(qemu-user-static binfmt-support g++-mips-linux-gnu) 71 packages+=(qemu-user-static binfmt-support g++-mipsel-linux-gnu)
72 ;; 72 ;;
73 mips64) 73 mips64)
74 packages+=(qemu-user-static binfmt-support g++-mips64el-linux-gnuabi64) 74 packages+=(qemu-user-static binfmt-support g++-mips64el-linux-gnuabi64)
diff --git a/configure.ac b/configure.ac
index 12703dd..7c6ac98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,7 @@ AS_CASE([$host_cpu],
95 [*amd64*], [host_cpu=x86_64 HOSTARCH=intel], 95 [*amd64*], [host_cpu=x86_64 HOSTARCH=intel],
96 [i?86], [host_cpu=i386 HOSTARCH=intel enable_asm=no], 96 [i?86], [host_cpu=i386 HOSTARCH=intel enable_asm=no],
97 [mips64*], [host_cpu=mips64 enable_asm=${enable_asm-no}], 97 [mips64*], [host_cpu=mips64 enable_asm=${enable_asm-no}],
98 [mips*], [host_cpu=mips enable_asm=no], 98 [mips*], [host_cpu=mips enable_asm=${enable_asm-no}],
99 [powerpc*], [host_cpu=powerpc], 99 [powerpc*], [host_cpu=powerpc],
100 [ppc64*], [host_cpu=powerpc64], 100 [ppc64*], [host_cpu=powerpc64],
101 [x86_64], [HOSTARCH=intel] 101 [x86_64], [HOSTARCH=intel]
diff --git a/crypto/Makefile.am.elf-mips b/crypto/Makefile.am.elf-mips
index 2276991..682fb5e 100644
--- a/crypto/Makefile.am.elf-mips
+++ b/crypto/Makefile.am.elf-mips
@@ -2,7 +2,6 @@ ASM_MIPS_ELF = aes/aes-mips.S
2ASM_MIPS_ELF += bn/bn-mips.S 2ASM_MIPS_ELF += bn/bn-mips.S
3ASM_MIPS_ELF += bn/mont-mips.S 3ASM_MIPS_ELF += bn/mont-mips.S
4ASM_MIPS_ELF += sha/sha1-mips.S 4ASM_MIPS_ELF += sha/sha1-mips.S
5ASM_MIPS_ELF += sha/sha512-mips.S
6ASM_MIPS_ELF += sha/sha256-mips.S 5ASM_MIPS_ELF += sha/sha256-mips.S
7 6
8EXTRA_DIST += $(ASM_MIPS_ELF) 7EXTRA_DIST += $(ASM_MIPS_ELF)
diff --git a/crypto/arch/mips/crypto_arch.h b/crypto/arch/mips/crypto_arch.h
index 274879c..2407503 100644
--- a/crypto/arch/mips/crypto_arch.h
+++ b/crypto/arch/mips/crypto_arch.h
@@ -18,4 +18,22 @@
18#ifndef HEADER_CRYPTO_ARCH_H 18#ifndef HEADER_CRYPTO_ARCH_H
19#define HEADER_CRYPTO_ARCH_H 19#define HEADER_CRYPTO_ARCH_H
20 20
21#ifndef OPENSSL_NO_ASM
22
23#ifdef LIBRESSL_USE_AES_ASSEMBLY
24#define HAVE_AES_SET_ENCRYPT_KEY_INTERNAL
25#define HAVE_AES_SET_DECRYPT_KEY_INTERNAL
26#define HAVE_AES_ENCRYPT_INTERNAL
27#define HAVE_AES_DECRYPT_INTERNAL
28#endif
29
30#ifdef LIBRESSL_USE_SHA_ASSEMBLY
31#define HAVE_SHA1_BLOCK_DATA_ORDER
32#define HAVE_SHA1_BLOCK_GENERIC
33#define HAVE_SHA256_BLOCK_DATA_ORDER
34#define HAVE_SHA256_BLOCK_GENERIC
35#endif
36
37#endif
38
21#endif 39#endif
diff --git a/crypto/bn/arch/mips/bn_arch.h b/crypto/bn/arch/mips/bn_arch.h
index 4d6571f..a14b83b 100644
--- a/crypto/bn/arch/mips/bn_arch.h
+++ b/crypto/bn/arch/mips/bn_arch.h
@@ -20,5 +20,24 @@
20 20
21#ifndef OPENSSL_NO_ASM 21#ifndef OPENSSL_NO_ASM
22 22
23#ifdef LIBRESSL_USE_BN_ASSEMBLY
24
25#define HAVE_BN_ADD_WORDS
26
27#define HAVE_BN_DIV_WORDS
28#define HAVE_BN_DIV_3_WORDS
29
30#define HAVE_BN_MUL_COMBA4
31#define HAVE_BN_MUL_COMBA8
32#define HAVE_BN_MULW_ADD_WORDS
33#define HAVE_BN_MULW_WORDS
34
35#define HAVE_BN_SQR_COMBA4
36#define HAVE_BN_SQR_COMBA8
37
38#define HAVE_BN_SUB_WORDS
39
40#endif
41
23#endif 42#endif
24#endif 43#endif
diff --git a/scripts/test b/scripts/test
index 6d573e3..b3386a8 100755
--- a/scripts/test
+++ b/scripts/test
@@ -173,11 +173,12 @@ elif [ "$ARCH" = "riscv64" ]; then
173 173
174elif [ "$ARCH" = "mips32" ] || [ "$ARCH" = "mips64" ]; then 174elif [ "$ARCH" = "mips32" ] || [ "$ARCH" = "mips64" ]; then
175 if [ "$ARCH" = "mips32" ]; then 175 if [ "$ARCH" = "mips32" ]; then
176 sudo ln -sf /usr/mips-linux-gnu/lib/ld.so.1 /lib/ 176 sudo ln -sf /usr/mipsel-linux-gnu/lib/ld.so.1 /lib/
177 setup_cross_compiler mips-linux-gnu 177 setup_cross_compiler mipsel-linux-gnu
178 178
179 ./configure --host=mips-linux-gnu 179 # MIPS32 assembly is disabled by default, so enable it for CI coverage.
180 LD_LIBRARY_PATH=/usr/mips-linux-gnu/lib make -j 4 check 180 ./configure --host=mipsel-linux-gnu --enable-asm
181 LD_LIBRARY_PATH=/usr/mipsel-linux-gnu/lib make -j 4 check
181 else 182 else
182 sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64 183 sudo ln -sf /usr/mips64el-linux-gnuabi64/lib64/ld.so.1 /lib64
183 setup_cross_compiler mips64el-linux-gnuabi64 184 setup_cross_compiler mips64el-linux-gnuabi64
diff --git a/update.sh b/update.sh
index ddd2cf3..4b2c4dd 100755
--- a/update.sh
+++ b/update.sh
@@ -248,7 +248,6 @@ gen_asm_mips o32 bn mips bn-mips
248gen_asm_mips o32 bn mips-mont mont-mips 248gen_asm_mips o32 bn mips-mont mont-mips
249gen_asm_mips o32 sha sha1-mips sha1-mips 249gen_asm_mips o32 sha sha1-mips sha1-mips
250gen_asm_mips o32 sha sha512-mips sha256-mips 250gen_asm_mips o32 sha sha512-mips sha256-mips
251gen_asm_mips o32 sha sha512-mips sha512-mips
252 251
253echo generating mips64 ASM source for elf 252echo generating mips64 ASM source for elf
254gen_asm_mips 64 aes aes-mips aes-mips64 253gen_asm_mips 64 aes aes-mips aes-mips64