From 34f952183a880e5362c06fa00f4ad884fcf0a61c Mon Sep 17 00:00:00 2001 From: Bill Yang Date: Thu, 13 Jun 2024 13:34:49 -0700 Subject: [PATCH] try something to fix unreproducable error --- crypto/CMakeLists.txt | 8 ++++--- crypto/fips_hashing/CMakeLists.txt | 34 ++++++++++++++++-------------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 74c05813be5..86e0ab7b4e3 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -268,8 +268,10 @@ if(GO_EXECUTABLE) else() file(COPY ${GENERATE_CODE_ROOT}/err_data.c DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/) endif() -add_library(generated_err_data OBJECT err_data.c) -target_include_directories(generated_err_data PRIVATE ${PROJECT_SOURCE_DIR}/include) +if(FIPS) + add_library(generated_err_data OBJECT err_data.c) + target_include_directories(generated_err_data PRIVATE ${PROJECT_SOURCE_DIR}/include) +endif() set(DILITHIUM_SOURCES) if(ENABLE_DILITHIUM) @@ -617,7 +619,7 @@ if(FIPS_SHARED) -p $ -o $ ${INJECT_HASH_APPLE_FLAG} DEPENDS inject_hash WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - ) + ) else() add_custom_command( TARGET crypto POST_BUILD diff --git a/crypto/fips_hashing/CMakeLists.txt b/crypto/fips_hashing/CMakeLists.txt index d0e8ceee07c..02a1ea6b7b2 100644 --- a/crypto/fips_hashing/CMakeLists.txt +++ b/crypto/fips_hashing/CMakeLists.txt @@ -1,21 +1,23 @@ -add_definitions(-DOPENSSL_NO_ASM=1) -remove_definitions(-DBORINGSSL_FIPS -DFIPS_ENTROPY_SOURCE_JITTER_CPU -DFIPS_ENTROPY_SOURCE_PASSIVE) +if(FIPS AND APPLE) + add_definitions(-DOPENSSL_NO_ASM=1) + remove_definitions(-DBORINGSSL_FIPS -DFIPS_ENTROPY_SOURCE_JITTER_CPU -DFIPS_ENTROPY_SOURCE_PASSIVE) -add_library( - fips_hashing - - STATIC + add_library( + fips_hashing + + STATIC - fips_hashing.c + fips_hashing.c - ../mem.c - ../thread_none.c - ../thread_pthread.c + ../mem.c + ../thread_none.c + ../thread_pthread.c - ../err/err.c - ../decrepit/ripemd/ripemd.c -) + ../err/err.c + $ + ../decrepit/ripemd/ripemd.c + ) -SET_TARGET_PROPERTIES(fips_hashing PROPERTIES LINKER_LANGUAGE C) -target_include_directories(fips_hashing PUBLIC $) -target_link_libraries(fips_hashing generated_err_data) + SET_TARGET_PROPERTIES(fips_hashing PROPERTIES LINKER_LANGUAGE C) + target_include_directories(fips_hashing PUBLIC $) +endif() \ No newline at end of file