diff options
| author | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-08-12 13:44:41 +0900 |
|---|---|---|
| committer | Kenjiro Nakayama <nakayamakenjiro@gmail.com> | 2026-08-12 14:24:45 +0900 |
| commit | 3e403cfebd94cbff248e7acac5073a7a123c421b (patch) | |
| tree | 8b4f0cf6d5a40f57a848551a11f89548fd6f879e | |
| parent | 5c9fab02349c8c426840320867c6611b6755cd9d (diff) | |
| download | portable-3e403cfebd94cbff248e7acac5073a7a123c421b.tar.gz portable-3e403cfebd94cbff248e7acac5073a7a123c421b.tar.bz2 portable-3e403cfebd94cbff248e7acac5073a7a123c421b.zip | |
crypto: limit MSVC ARM64 workaround to older compilers
Apply the ARM64 bn_ct_ne_zero() workaround to MSVC versions older
than 19.51.36252. This compiler was verified to generate correct code
without the workaround.
| -rw-r--r-- | patches/win32_arm64_bn_arch.h.patch | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/patches/win32_arm64_bn_arch.h.patch b/patches/win32_arm64_bn_arch.h.patch new file mode 100644 index 0000000..0d0db42 --- /dev/null +++ b/patches/win32_arm64_bn_arch.h.patch | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | --- crypto/bn/arch/aarch64/bn_arch.h.orig | ||
| 2 | +++ crypto/bn/arch/aarch64/bn_arch.h | ||
| 3 | @@ -20,4 +20,18 @@ | ||
| 4 | #ifndef HEADER_BN_ARCH_H | ||
| 5 | #define HEADER_BN_ARCH_H | ||
| 6 | - | ||
| 7 | +/* See pull/1355. */ | ||
| 8 | +#if defined(_MSC_VER) && defined(_M_ARM64) && _MSC_FULL_VER < 195136252 | ||
| 9 | + | ||
| 10 | +#include <intrin.h> | ||
| 11 | + | ||
| 12 | +#define HAVE_BN_CT_NE_ZERO | ||
| 13 | + | ||
| 14 | +static inline int | ||
| 15 | +bn_ct_ne_zero(BN_ULONG w) | ||
| 16 | +{ | ||
| 17 | + return 1U ^ (_CountLeadingZeros64((unsigned __int64)w) >> 6); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +#endif | ||
| 21 | + | ||
| 22 | #ifndef OPENSSL_NO_ASM | ||
