Skip to content

Commit

Permalink
crypto: Guard code with ENABLE_SSE41 macro
Browse files Browse the repository at this point in the history
The code in `sha_x86_shani.cpp` uses the `_mm_blend_epi16` function from
the SSE4.1 instruction set extension. However, it is possible that
SHA-NI is enabled even when SSE4.1 is disabled.

This changes avoid compilation errors in such a condition.
  • Loading branch information
hebasto committed Nov 16, 2023
1 parent 4d41ed5 commit 85b3c0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/crypto/sha256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<sha256_x86_shani::Transform>;
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/sha256_x86_shani.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 85b3c0f

Please sign in to comment.