aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-02-12 14:26:16 +0000
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2024-03-05 11:36:46 +0000
commitd440f13db02c82c842000abe4fe4d0c721a4ad3b (patch)
tree8c89c6f41e8329df6ee59de5c96188b56e4a5c88 /src/crypto
parent6ec1ca7c85a4009b77e149a798a331592b96ea42 (diff)
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.
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/sha256.cpp2
-rw-r--r--src/crypto/sha256_x86_shani.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp
index 4c7bb6f20f..bb98cd09d2 100644
--- a/src/crypto/sha256.cpp
+++ b/src/crypto/sha256.cpp
@@ -623,7 +623,7 @@ std::string SHA256AutoDetect(sha256_implementation::UseImplementation use_implem
}
}
-#if defined(ENABLE_X86_SHANI)
+#if defined(ENABLE_SSE41) && defined(ENABLE_X86_SHANI)
if (have_x86_shani) {
Transform = sha256_x86_shani::Transform;
TransformD64 = TransformD64Wrapper<sha256_x86_shani::Transform>;
diff --git a/src/crypto/sha256_x86_shani.cpp b/src/crypto/sha256_x86_shani.cpp
index 79871bfcc1..7471828193 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 <stdint.h>
#include <immintrin.h>