From ceb7a1656606dfd81f89cde4fb7c6bafeb186cb3 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 16 Nov 2023 14:41:32 +0000 Subject: [PATCH] crypto: Guard code with `ENABLE_SSE41` macro The code in `sha_x86_shani.cpp` uses the `_mm_blend_epi16` function from the SSE4.1 instruction set. However, it is possible that SHA-NI is enabled even when SSE4.1 is disabled. This changes avoid compilation errors in such a condition. --- src/crypto/sha256.cpp | 2 +- src/crypto/sha256_x86_shani.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 5eacaa44e18aa..2d4ced93b23cb 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -616,7 +616,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem } } -#if defined(ENABLE_X86_SHANI) && !defined(BUILD_BITCOIN_INTERNAL) +#if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI) && !defined(BUILD_BITCOIN_INTERNAL) if (have_x86_shani) { Transform = sha256_x86_shani::Transform; TransformD64 = TransformD64Wrapper; diff --git a/src/crypto/sha256_x86_shani.cpp b/src/crypto/sha256_x86_shani.cpp index 79871bfcc112a..7471828193970 100644 --- a/src/crypto/sha256_x86_shani.cpp +++ b/src/crypto/sha256_x86_shani.cpp @@ -6,7 +6,7 @@ // Written and placed in public domain by Jeffrey Walton. // Based on code from Intel, and by Sean Gulley for the miTLS project. -#ifdef ENABLE_X86_SHANI +#if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI) #include #include