From 8cddaf034550bfea6e7d9ec57af1af822eb33053 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 26 Mar 2024 00:38:32 +0000 Subject: mingw: re-enable endbr opcode, add workaround for clang `cet.h` issue - https://github.com/libressl/openbsd/pull/149 fixes to crash on startup issue, thus nuking all endbr opcodes is no longer necessary. This effectively enables CET in ASM code for MinGW x86_64 builds. - llvm `cet.h` (as of v18) assigns `endbr32` instead of `endbr64` to `_CET_ENDBR` macro for MinGW x86_64 targets. https://github.com/llvm/llvm-project/blob/llvmorg-18.1.1/clang/lib/Headers/cet.h#L15-L35 Work this around by mapping `endbr32` to `endbr64`. Prerequisite: https://github.com/libressl/openbsd/pull/149 Fixes: https://github.com/libressl/portable/issues/1015 --- crypto/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 110a673..87fb2d8 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -193,7 +193,7 @@ if(HOST_ASM_MINGW64_X86_64) whrlpool/wp-mingw64-x86_64.S cpuid-mingw64-x86_64.S ) - add_definitions(-Dendbr64=) + add_definitions(-Dendbr32=endbr64) add_definitions(-DAES_ASM) add_definitions(-DBSAES_ASM) add_definitions(-DVPAES_ASM) -- cgit v1.2.3-55-g6feb From 6b55fd7f4cb7b36d0691739650bb9a8e3e8398f9 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Tue, 26 Mar 2024 07:13:18 +0000 Subject: also for autotools --- crypto/Makefile.am.mingw64-x86_64 | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/Makefile.am.mingw64-x86_64 b/crypto/Makefile.am.mingw64-x86_64 index 5a277c5..12f41a5 100644 --- a/crypto/Makefile.am.mingw64-x86_64 +++ b/crypto/Makefile.am.mingw64-x86_64 @@ -21,6 +21,7 @@ ASM_X86_64_MINGW64 += cpuid-mingw64-x86_64.S EXTRA_DIST += $(ASM_X86_64_MINGW64) if HOST_ASM_MINGW64_X86_64 +libcrypto_la_CPPFLAGS += -Dendbr32=endbr64 libcrypto_la_CPPFLAGS += -DAES_ASM libcrypto_la_CPPFLAGS += -DBSAES_ASM libcrypto_la_CPPFLAGS += -DVPAES_ASM -- cgit v1.2.3-55-g6feb