From 0daa8adfe8f6fa2adb6bfe086bc8910c95ee3e9d Mon Sep 17 00:00:00 2001 From: Theo Buehler Date: Sun, 29 Jun 2025 03:55:04 -0600 Subject: Adjust to GCM refactoring --- crypto/CMakeLists.txt | 4 ++++ crypto/Makefile.am.elf-x86_64 | 1 + crypto/Makefile.am.macosx-x86_64 | 1 + crypto/Makefile.am.masm-x86_64 | 1 + crypto/Makefile.am.mingw64-x86_64 | 1 + patches/aarch64_crypto_arch.h.patch | 16 ++++++++++++++++ patches/amd64_crypto_arch.h.patch | 18 ++++++++++++++++++ patches/crypto_arch.h.patch | 34 ---------------------------------- update.sh | 1 + 9 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 patches/aarch64_crypto_arch.h.patch create mode 100644 patches/amd64_crypto_arch.h.patch delete mode 100644 patches/crypto_arch.h.patch diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 7b788fc..b1ec1b2 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -18,6 +18,7 @@ add_definitions(-DLIBRESSL_CRYPTO_INTERNAL) if(HOST_ASM_ELF_X86_64) set(CRYPTO_SRC ${CRYPTO_SRC} aes/aes_amd64.c) set(CRYPTO_SRC ${CRYPTO_SRC} bn/arch/amd64/bn_arch.c) + set(CRYPTO_SRC ${CRYPTO_SRC} modes/gcm128_amd64.c) set( ASM_X86_64_ELF_SRC @@ -55,6 +56,7 @@ endif() if(HOST_ASM_MACOSX_X86_64) set(CRYPTO_SRC ${CRYPTO_SRC} aes/aes_amd64.c) set(CRYPTO_SRC ${CRYPTO_SRC} bn/arch/amd64/bn_arch.c) + set(CRYPTO_SRC ${CRYPTO_SRC} modes/gcm128_amd64.c) set( ASM_X86_64_MACOSX_SRC @@ -92,6 +94,7 @@ endif() if(HOST_ASM_MASM_X86_64) set(CRYPTO_SRC ${CRYPTO_SRC} aes/aes_amd64.c) + set(CRYPTO_SRC ${CRYPTO_SRC} modes/gcm128_amd64.c) set( ASM_X86_64_MASM_SRC @@ -118,6 +121,7 @@ endif() if(HOST_ASM_MINGW64_X86_64) set(CRYPTO_SRC ${CRYPTO_SRC} aes/aes_amd64.c) + set(CRYPTO_SRC ${CRYPTO_SRC} modes/gcm128_amd64.c) set( ASM_X86_64_MINGW64_SRC diff --git a/crypto/Makefile.am.elf-x86_64 b/crypto/Makefile.am.elf-x86_64 index 9e4775e..ad49787 100644 --- a/crypto/Makefile.am.elf-x86_64 +++ b/crypto/Makefile.am.elf-x86_64 @@ -24,6 +24,7 @@ EXTRA_DIST += $(ASM_X86_64_ELF) if HOST_ASM_ELF_X86_64 libcrypto_la_SOURCES += aes/aes_amd64.c libcrypto_la_SOURCES += bn/arch/amd64/bn_arch.c +libcrypto_la_SOURCES += modes/gcm128_amd64.c libcrypto_la_CPPFLAGS += -DAES_ASM libcrypto_la_CPPFLAGS += -DBSAES_ASM diff --git a/crypto/Makefile.am.macosx-x86_64 b/crypto/Makefile.am.macosx-x86_64 index 7a5ad58..bbccfd6 100644 --- a/crypto/Makefile.am.macosx-x86_64 +++ b/crypto/Makefile.am.macosx-x86_64 @@ -24,6 +24,7 @@ EXTRA_DIST += $(ASM_X86_64_MACOSX) if HOST_ASM_MACOSX_X86_64 libcrypto_la_SOURCES += aes/aes_amd64.c libcrypto_la_SOURCES += bn/arch/amd64/bn_arch.c +libcrypto_la_SOURCES += modes/gcm128_amd64.c libcrypto_la_CPPFLAGS += -DAES_ASM libcrypto_la_CPPFLAGS += -DBSAES_ASM diff --git a/crypto/Makefile.am.masm-x86_64 b/crypto/Makefile.am.masm-x86_64 index ee46bc4..bb94e3a 100644 --- a/crypto/Makefile.am.masm-x86_64 +++ b/crypto/Makefile.am.masm-x86_64 @@ -11,6 +11,7 @@ EXTRA_DIST += $(ASM_X86_64_MASM) if HOST_ASM_MASM_X86_64 libcrypto_la_SOURCES += aes/aes_amd64.c +libcrypto_la_SOURCES += modes/gcm128_amd64.c libcrypto_la_CPPFLAGS += -DAES_ASM libcrypto_la_CPPFLAGS += -DBSAES_ASM diff --git a/crypto/Makefile.am.mingw64-x86_64 b/crypto/Makefile.am.mingw64-x86_64 index 3dafa86..efe2643 100644 --- a/crypto/Makefile.am.mingw64-x86_64 +++ b/crypto/Makefile.am.mingw64-x86_64 @@ -11,6 +11,7 @@ EXTRA_DIST += $(ASM_X86_64_MINGW64) if HOST_ASM_MINGW64_X86_64 libcrypto_la_SOURCES += aes/aes_amd64.c +libcrypto_la_SOURCES += modes/gcm128_amd64.c libcrypto_la_CPPFLAGS += -Dendbr32=endbr64 libcrypto_la_CPPFLAGS += -DAES_ASM diff --git a/patches/aarch64_crypto_arch.h.patch b/patches/aarch64_crypto_arch.h.patch new file mode 100644 index 0000000..e6a8cbf --- /dev/null +++ b/patches/aarch64_crypto_arch.h.patch @@ -0,0 +1,16 @@ +--- crypto/arch/aarch64/crypto_arch.h.orig Sun Jun 29 03:49:56 2025 ++++ crypto/arch/aarch64/crypto_arch.h Sun Jun 29 04:00:13 2025 +@@ -34,11 +34,13 @@ extern uint64_t crypto_cpu_caps_aarch64; + #define CRYPTO_CPU_CAPS_AARCH64_SHA3 (1ULL << 5) + + #ifndef OPENSSL_NO_ASM ++#if 0 + + #define HAVE_SHA1_BLOCK_DATA_ORDER + #define HAVE_SHA256_BLOCK_DATA_ORDER + #define HAVE_SHA512_BLOCK_DATA_ORDER + ++#endif + #endif + + #endif diff --git a/patches/amd64_crypto_arch.h.patch b/patches/amd64_crypto_arch.h.patch new file mode 100644 index 0000000..64c78dd --- /dev/null +++ b/patches/amd64_crypto_arch.h.patch @@ -0,0 +1,18 @@ +--- crypto/arch/amd64/crypto_arch.h.orig Sun Jun 29 03:49:56 2025 ++++ crypto/arch/amd64/crypto_arch.h Sun Jun 29 03:57:10 2025 +@@ -45,6 +45,7 @@ extern uint64_t crypto_cpu_caps_amd64; + #define HAVE_RC4_INTERNAL + #define HAVE_RC4_SET_KEY_INTERNAL + ++#if 0 + #define HAVE_SHA1_BLOCK_DATA_ORDER + #define HAVE_SHA1_BLOCK_GENERIC + +@@ -53,6 +54,7 @@ extern uint64_t crypto_cpu_caps_amd64; + + #define HAVE_SHA512_BLOCK_DATA_ORDER + #define HAVE_SHA512_BLOCK_GENERIC ++#endif + + #endif + diff --git a/patches/crypto_arch.h.patch b/patches/crypto_arch.h.patch deleted file mode 100644 index b13ffab..0000000 --- a/patches/crypto_arch.h.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- crypto/arch/amd64/crypto_arch.h.orig Mon Jun 16 10:38:27 2025 -+++ crypto/arch/amd64/crypto_arch.h Mon Jun 16 10:38:39 2025 -@@ -41,6 +41,7 @@ extern uint64_t crypto_cpu_caps_amd64; - #define HAVE_RC4_INTERNAL - #define HAVE_RC4_SET_KEY_INTERNAL - -+#if 0 - #define HAVE_SHA1_BLOCK_DATA_ORDER - #define HAVE_SHA1_BLOCK_GENERIC - -@@ -49,6 +50,7 @@ extern uint64_t crypto_cpu_caps_amd64; - - #define HAVE_SHA512_BLOCK_DATA_ORDER - #define HAVE_SHA512_BLOCK_GENERIC -+#endif - - #endif - ---- crypto/arch/aarch64/crypto_arch.h.orig Thu Mar 13 05:42:37 2025 -+++ crypto/arch/aarch64/crypto_arch.h Thu Mar 13 05:47:39 2025 -@@ -33,11 +33,13 @@ - #define CRYPTO_CPU_CAPS_AARCH64_SHA512 (1ULL << 4) - #define CRYPTO_CPU_CAPS_AARCH64_SHA3 (1ULL << 5) - -+#if 0 - #ifndef OPENSSL_NO_ASM - - #define HAVE_SHA256_BLOCK_DATA_ORDER - #define HAVE_SHA512_BLOCK_DATA_ORDER - -+#endif - #endif - - #endif diff --git a/update.sh b/update.sh index 2aab899..e8b0566 100755 --- a/update.sh +++ b/update.sh @@ -181,6 +181,7 @@ done for arch in amd64 i386; do $CP $libcrypto_src/aes/aes_${arch}.c crypto/aes/ + $CP $libcrypto_src/modes/gcm128_${arch}.c crypto/modes/ done for i in $libcrypto_src/arch/*; do -- cgit v1.2.3-55-g6feb