From 1087da12fc815a84592454980cdcd5d34b07285b Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Fri, 11 Apr 2025 18:31:04 +0200 Subject: Sync opensslconf.h, add crypto_arch.h for mips This was easy enough to make compile. As long as it doesn't get in the way, I think we can keep this. Fixes #1110 --- .github/workflows/linux.yml | 2 +- .gitignore | 2 ++ crypto/CMakeLists.txt | 2 +- crypto/Makefile.am | 3 ++- crypto/arch/mips/crypto_arch.h | 21 +++++++++++++++++++++ include/arch/mips/opensslconf.h | 22 +++++++++++----------- ssl/CMakeLists.txt | 2 +- ssl/Makefile.am | 3 ++- tests/CMakeLists.txt | 2 +- tests/Makefile.am | 2 +- 10 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 crypto/arch/mips/crypto_arch.h diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 88dd15e..8334ae6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: os: ["ubuntu-22.04", "ubuntu-24.04"] - arch: ["native", "arm32", "arm64", "mingw32", "mingw64", "mips64"] + arch: ["native", "arm32", "arm64", "mingw32", "mingw64", "mips32", "mips64"] compiler: ["gcc"] include: - os: "ubuntu-22.04" diff --git a/.gitignore b/.gitignore index 14917f9..7aff24f 100644 --- a/.gitignore +++ b/.gitignore @@ -239,6 +239,8 @@ include/openssl/*.h /crypto/* !/crypto/Makefile.am.* +!/crypto/arch/ +!/crypto/arch/mips/* !/crypto/compat/ /crypto/compat/* !/crypto/compat/arc4random.h diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index a714059..64bccd8 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -781,7 +781,7 @@ elseif(HOST_MIPS64) target_include_directories(crypto_obj PRIVATE arch/mips64) target_include_directories(crypto_obj PRIVATE bn/arch/mips64) elseif(HOST_MIPS) - # XXX - can this go away? the directory doesn't exist... + target_include_directories(crypto_obj PRIVATE arch/mips) target_include_directories(crypto_obj PRIVATE bn/arch/mips) elseif(HOST_POWERPC) target_include_directories(crypto_obj PRIVATE arch/powerpc) diff --git a/crypto/Makefile.am b/crypto/Makefile.am index 0952494..d1c5b76 100644 --- a/crypto/Makefile.am +++ b/crypto/Makefile.am @@ -403,10 +403,11 @@ endif noinst_HEADERS += arch/loongarch64/crypto_arch.h noinst_HEADERS += bn/arch/loongarch64/bn_arch.h -# XXX - do we still need this? if HOST_MIPS +libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/arch/mips/ libcrypto_la_CPPFLAGS += -I$(top_srcdir)/crypto/bn/arch/mips/ endif +noinst_HEADERS += arch/mips/crypto_arch.h noinst_HEADERS += bn/arch/mips/bn_arch.h if HOST_MIPS64 diff --git a/crypto/arch/mips/crypto_arch.h b/crypto/arch/mips/crypto_arch.h new file mode 100644 index 0000000..274879c --- /dev/null +++ b/crypto/arch/mips/crypto_arch.h @@ -0,0 +1,21 @@ +/* $OpenBSD$ */ +/* + * Copyright (c) 2024 Joel Sing + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef HEADER_CRYPTO_ARCH_H +#define HEADER_CRYPTO_ARCH_H + +#endif diff --git a/include/arch/mips/opensslconf.h b/include/arch/mips/opensslconf.h index f17d3d2..a5d26b6 100644 --- a/include/arch/mips/opensslconf.h +++ b/include/arch/mips/opensslconf.h @@ -1,15 +1,22 @@ #include /* crypto/opensslconf.h.in */ -#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#if defined(HEADER_CRYPTO_LOCAL_H) && !defined(OPENSSLDIR) #define OPENSSLDIR "/etc/ssl" #endif -#undef OPENSSL_UNISTD -#define OPENSSL_UNISTD - #undef OPENSSL_EXPORT_VAR_AS_FUNCTION +#ifndef OPENSSL_FILE +#ifdef OPENSSL_NO_FILENAMES +#define OPENSSL_FILE "" +#define OPENSSL_LINE 0 +#else +#define OPENSSL_FILE __FILE__ +#define OPENSSL_LINE __LINE__ +#endif +#endif + #if defined(HEADER_IDEA_H) && !defined(IDEA_INT) #define IDEA_INT unsigned int #endif @@ -68,13 +75,6 @@ #undef EIGHT_BIT #endif -#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) -#define CONFIG_HEADER_RC4_LOCL_H -/* if this is defined data[i] is used instead of *data, this is a %20 - * speedup on x86 */ -#define RC4_INDEX -#endif - #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) #define CONFIG_HEADER_BF_LOCL_H #undef BF_PTR diff --git a/ssl/CMakeLists.txt b/ssl/CMakeLists.txt index 5baa5bc..cd7e335 100644 --- a/ssl/CMakeLists.txt +++ b/ssl/CMakeLists.txt @@ -122,7 +122,7 @@ elseif(HOST_LOONGARCH64) elseif(HOST_MIPS64) target_include_directories(ssl_obj PRIVATE ../crypto/arch/mips64) elseif(HOST_MIPS) - # XXX - can this go away? the directory doesn't exist... + target_include_directories(ssl_obj PRIVATE ../crypto/arch/mips) elseif(HOST_POWERPC) target_include_directories(ssl_obj PRIVATE ../crypto/arch/powerpc) elseif(HOST_POWERPC64) diff --git a/ssl/Makefile.am b/ssl/Makefile.am index 8beb65a..2c84bff 100644 --- a/ssl/Makefile.am +++ b/ssl/Makefile.am @@ -136,9 +136,10 @@ libssl_la_CPPFLAGS += -I$(top_srcdir)/crypto/arch/loongarch64/ endif noinst_HEADERS += $(top_srcdir)/crypto/arch/loongarch64/crypto_arch.h -# XXX - do we still need this? if HOST_MIPS +libssl_la_CPPFLAGS += -I$(top_srcdir)/crypto/arch/mips/ endif +noinst_HEADERS += $(top_srcdir)/crypto/arch/mips/crypto_arch.h if HOST_MIPS64 libssl_la_CPPFLAGS += -I$(top_srcdir)/crypto/arch/mips64/ diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 72e36d4..d7cc499 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,7 +33,7 @@ elseif(HOST_LOONGARCH64) elseif(HOST_MIPS64) include_directories(../crypto/arch/mips64) elseif(HOST_MIPS) - # XXX - can this go away? the directory doesn't exist... + include_directories(../crypto/arch/mips) elseif(HOST_POWERPC) include_directories(../crypto/arch/powerpc) elseif(HOST_POWERPC64) diff --git a/tests/Makefile.am b/tests/Makefile.am index 217f445..b58de21 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -40,8 +40,8 @@ if HOST_LOONGARCH64 AM_CPPFLAGS += -I$(top_srcdir)/crypto/arch/loongarch64/ endif -# XXX - do we still need this? if HOST_MIPS +AM_CPPFLAGS += -I$(top_srcdir)/crypto/arch/mips/ endif if HOST_MIPS64 -- cgit v1.2.3-55-g6feb