Skip to content

Commit

Permalink
Ensure SSE2 is enabled when using optimized assembly for 32-bit x86 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
graebm authored Sep 13, 2024
1 parent 821dff4 commit 67e44f9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,16 @@ else()
set(ARCH "generic")
endif()

# If target ARCH is 32-bit x86, ensure SSE2 is enabled since it's used by the optimized assembly.
# To build for targets that do not support SSE2, use the `OPENSSL_NO_ASM` flag.
if(ARCH STREQUAL "x86" AND NOT OPENSSL_NO_SSE2_FOR_TESTING)
# Most compilers enable SSE2 in 32-bit x86 by default, but in some cases GCC and Clang don't.
# See: https://github.com/aws/aws-lc/commit/6fe8dcbe96e580ea85233fdb98a142e42951b70b
if(GCC OR CLANG)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
endif()
endif()

if(ENABLE_DATA_INDEPENDENT_TIMING_AARCH64)
add_definitions(-DMAKE_DIT_AVAILABLE)
endif()
Expand Down

0 comments on commit 67e44f9

Please sign in to comment.