Commit bfe612b7 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-23663 - Add HAVE_INTEL_RDRAND flag for building WolfSSL, where appropiate

parent de76bebc
......@@ -19,6 +19,8 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
MY_CHECK_C_COMPILER_FLAG(-maes)
MY_CHECK_C_COMPILER_FLAG(-msse4)
MY_CHECK_C_COMPILER_FLAG(-mpclmul)
MY_CHECK_C_COMPILER_FLAG(-mrdrnd)
MY_CHECK_C_COMPILER_FLAG(-mrdseed)
IF(have_C__maes AND have_C__msse4 AND have_C__mpclmul)
SET(WOLFSSL_INTELASM ON)
ENDIF()
......@@ -113,20 +115,27 @@ IF(WOLFSSL_INTELASM)
LIST(APPEND WOLFCRYPT_SOURCES ${WOLFCRYPT_SRCDIR}/cpuid.c)
IF(MSVC)
LIST(APPEND WOLFCRYPT_SOURCES ${WOLFCRYPT_SRCDIR}/aes_asm.asm)
SET(WOLFSSL_X86_64_BUILD 1)
SET(HAVE_INTEL_RDSEED 1)
SET(HAVE_INTEL_RDRAND 1)
IF(CMAKE_C_COMPILER_ID MATCHES Clang)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
ELSE()
SET(HAVE_INTEL_RDSEED 1)
SET(WOLFSSL_X86_64_BUILD 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -msse4.2 -mpclmul -mrdrnd -mrdseed")
ENDIF()
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
SET(HAVE_INTEL_RDSEED 1)
SET(USE_INTEL_SPEEDUP 1)
LIST(APPEND WOLFCRYPT_SOURCES
${WOLFCRYPT_SRCDIR}/aes_asm.S
${WOLFCRYPT_SRCDIR}/sha512_asm.S
${WOLFCRYPT_SRCDIR}/sha256_asm.S)
ADD_DEFINITIONS(-maes -msse4 -mpclmul)
IF(have_C__mrdrnd)
SET(HAVE_INTEL_RDRAND 1)
ADD_DEFINITIONS(-mrdrnd)
ENDIF()
IF(have_C__mrdseed)
SET(HAVE_INTEL_RDSEED 1)
ADD_DEFINITIONS(-mrdseed)
ENDIF()
ENDIF()
ENDIF()
......
......@@ -32,6 +32,7 @@
#cmakedefine USE_FAST_MATH
#cmakedefine TFM_TIMING_RESISTANT
#cmakedefine HAVE_INTEL_RDSEED
#cmakedefine HAVE_INTEL_RDRAND
#cmakedefine USE_INTEL_SPEEDUP
#cmakedefine USE_FAST_MATH
#cmakedefine WOLFSSL_X86_64_BUILD
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment