commit f6dc828: [Fix] Restrict x86_64 assembly to x86_64

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Nov 6 12:21:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-06 12:16:28 +0000
URL: https://github.com/rspamd/rspamd/commit/f6dc828c3d8c015779eea7fb662198c6d58def14 (HEAD -> master)

[Fix] Restrict x86_64 assembly to x86_64
Issue: #3934

---
 src/libcryptobox/CMakeLists.txt | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/libcryptobox/CMakeLists.txt b/src/libcryptobox/CMakeLists.txt
index 272701b53..a7f86650c 100644
--- a/src/libcryptobox/CMakeLists.txt
+++ b/src/libcryptobox/CMakeLists.txt
@@ -5,17 +5,24 @@ SET(BASE64SRC ${CMAKE_CURRENT_SOURCE_DIR}/base64/ref.c
 		${CMAKE_CURRENT_SOURCE_DIR}/base64/base64.c)
 
 IF(HAVE_AVX2)
-	SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+	IF ("${ARCH}" STREQUAL "x86_64")
+		SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx2.S)
+		MESSAGE(STATUS "Cryptobox: AVX2 support is added (chacha20)")
+	ENDIF()
 	SET(BASE64SRC ${BASE64SRC} ${CMAKE_CURRENT_SOURCE_DIR}/base64/avx2.c)
-	MESSAGE(STATUS "Cryptobox: AVX2 support is added (chacha20, avx2)")
+	MESSAGE(STATUS "Cryptobox: AVX2 support is added (base64)")
 ENDIF(HAVE_AVX2)
 IF(HAVE_AVX)
-	SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
-	MESSAGE(STATUS "Cryptobox: AVX support is added (chacha20)")
+	IF ("${ARCH}" STREQUAL "x86_64")
+		SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/avx.S)
+		MESSAGE(STATUS "Cryptobox: AVX support is added (chacha20)")
+	ENDIF()
 ENDIF(HAVE_AVX)
 IF(HAVE_SSE2)
-	SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
-	MESSAGE(STATUS "Cryptobox: SSE2 support is added (chacha20)")
+	IF ("${ARCH}" STREQUAL "x86_64")
+		SET(CHACHASRC ${CHACHASRC} ${CMAKE_CURRENT_SOURCE_DIR}/chacha20/sse2.S)
+		MESSAGE(STATUS "Cryptobox: SSE2 support is added (chacha20)")
+	ENDIF()
 ENDIF(HAVE_SSE2)
 IF(HAVE_SSE42)
 	SET(BASE64SRC ${BASE64SRC} ${CMAKE_CURRENT_SOURCE_DIR}/base64/sse42.c)


More information about the Commits mailing list