This commit is contained in:
Michael Baentsch 2021-05-21 19:52:03 +00:00 committed by GitHub
parent 92e6418b35
commit 3a56677a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 61 additions and 53 deletions

View File

@ -28,13 +28,13 @@ endif()
endif()
# BIKE is not supported on Windows
cmake_dependent_option(OQS_ENABLE_KEM_BIKE "" ON "NOT WIN32" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_BIKE "Enable BIKE algorithm family" ON "NOT WIN32" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_bike1_l1_cpa "" ON "OQS_ENABLE_KEM_BIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_bike1_l1_fo "" ON "OQS_ENABLE_KEM_BIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_bike1_l3_cpa "" ON "OQS_ENABLE_KEM_BIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_bike1_l3_fo "" ON "OQS_ENABLE_KEM_BIKE" OFF)
option(OQS_ENABLE_KEM_FRODOKEM "" ON)
option(OQS_ENABLE_KEM_FRODOKEM "Enable Frodo algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_frodokem_640_aes "" ON "OQS_ENABLE_KEM_FRODOKEM" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_frodokem_640_shake "" ON "OQS_ENABLE_KEM_FRODOKEM" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_frodokem_976_aes "" ON "OQS_ENABLE_KEM_FRODOKEM" OFF)
@ -42,7 +42,7 @@ cmake_dependent_option(OQS_ENABLE_KEM_frodokem_976_shake "" ON "OQS_ENABLE_KEM_F
cmake_dependent_option(OQS_ENABLE_KEM_frodokem_1344_aes "" ON "OQS_ENABLE_KEM_FRODOKEM" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_frodokem_1344_shake "" ON "OQS_ENABLE_KEM_FRODOKEM" OFF)
option(OQS_ENABLE_KEM_SIKE "" ON)
option(OQS_ENABLE_KEM_SIKE "Enable SIKE algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_sike_p434 "" ON "OQS_ENABLE_KEM_SIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sike_p434_compressed "" ON "OQS_ENABLE_KEM_SIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sike_p503 "" ON "OQS_ENABLE_KEM_SIKE" OFF)
@ -52,7 +52,7 @@ cmake_dependent_option(OQS_ENABLE_KEM_sike_p610_compressed "" ON "OQS_ENABLE_KEM
cmake_dependent_option(OQS_ENABLE_KEM_sike_p751 "" ON "OQS_ENABLE_KEM_SIKE" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sike_p751_compressed "" ON "OQS_ENABLE_KEM_SIKE" OFF)
option(OQS_ENABLE_KEM_SIDH "" ON)
option(OQS_ENABLE_KEM_SIDH "Enable SIDH algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_sidh_p434 "" ON "OQS_ENABLE_KEM_SIDH" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sidh_p434_compressed "" ON "OQS_ENABLE_KEM_SIDH" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sidh_p503 "" ON "OQS_ENABLE_KEM_SIDH" OFF)
@ -62,7 +62,7 @@ cmake_dependent_option(OQS_ENABLE_KEM_sidh_p610_compressed "" ON "OQS_ENABLE_KEM
cmake_dependent_option(OQS_ENABLE_KEM_sidh_p751 "" ON "OQS_ENABLE_KEM_SIDH" OFF)
cmake_dependent_option(OQS_ENABLE_KEM_sidh_p751_compressed "" ON "OQS_ENABLE_KEM_SIDH" OFF)
option(OQS_ENABLE_SIG_PICNIC "" ON)
option(OQS_ENABLE_SIG_PICNIC "Enable Picnic algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_SIG_picnic_L1_UR "" ON "OQS_ENABLE_SIG_PICNIC" OFF)
cmake_dependent_option(OQS_ENABLE_SIG_picnic_L1_FS "" ON "OQS_ENABLE_SIG_PICNIC" OFF)
cmake_dependent_option(OQS_ENABLE_SIG_picnic_L1_full "" ON "OQS_ENABLE_SIG_PICNIC" OFF)
@ -77,7 +77,7 @@ cmake_dependent_option(OQS_ENABLE_SIG_picnic3_L3 "" ON "OQS_ENABLE_SIG_PICNIC" O
cmake_dependent_option(OQS_ENABLE_SIG_picnic3_L5 "" ON "OQS_ENABLE_SIG_PICNIC" OFF)
##### OQS_COPY_FROM_UPSTREAM_FRAGMENT_ADD_ENABLE_BY_ALG_START
option(OQS_ENABLE_KEM_CLASSIC_MCELIECE "" ON)
option(OQS_ENABLE_KEM_CLASSIC_MCELIECE "Enable classic_mceliece algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_classic_mceliece_348864 "" ON "OQS_ENABLE_KEM_CLASSIC_MCELIECE" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
@ -149,7 +149,7 @@ endif()
endif()
option(OQS_ENABLE_KEM_HQC "" ON)
option(OQS_ENABLE_KEM_HQC "Enable hqc algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_hqc_128 "" ON "OQS_ENABLE_KEM_HQC" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_BMI1_INSTRUCTIONS AND OQS_USE_PCLMULQDQ_INSTRUCTIONS))
@ -172,7 +172,7 @@ endif()
endif()
option(OQS_ENABLE_KEM_KYBER "" ON)
option(OQS_ENABLE_KEM_KYBER "Enable kyber algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_kyber_512 "" ON "OQS_ENABLE_KEM_KYBER" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_BMI2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
@ -216,7 +216,7 @@ endif()
endif()
option(OQS_ENABLE_KEM_NTRU "" ON)
option(OQS_ENABLE_KEM_NTRU "Enable ntru algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_ntru_hps2048509 "" ON "OQS_ENABLE_KEM_NTRU" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_BMI2_INSTRUCTIONS))
@ -246,7 +246,7 @@ endif()
endif()
option(OQS_ENABLE_KEM_NTRUPRIME "" ON)
option(OQS_ENABLE_KEM_NTRUPRIME "Enable ntruprime algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_ntruprime_ntrulpr653 "" ON "OQS_ENABLE_KEM_NTRUPRIME" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS))
@ -290,7 +290,7 @@ endif()
endif()
option(OQS_ENABLE_KEM_SABER "" ON)
option(OQS_ENABLE_KEM_SABER "Enable saber algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_KEM_saber_lightsaber "" ON "OQS_ENABLE_KEM_SABER" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS))
@ -313,7 +313,7 @@ endif()
endif()
option(OQS_ENABLE_SIG_DILITHIUM "" ON)
option(OQS_ENABLE_SIG_DILITHIUM "Enable dilithium algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_SIG_dilithium_2 "" ON "OQS_ENABLE_SIG_DILITHIUM" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin|Linux")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS AND OQS_USE_POPCNT_INSTRUCTIONS))
@ -357,7 +357,7 @@ endif()
endif()
option(OQS_ENABLE_SIG_FALCON "" ON)
option(OQS_ENABLE_SIG_FALCON "Enable falcon algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_SIG_falcon_512 "" ON "OQS_ENABLE_SIG_FALCON" OFF)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AVX2_INSTRUCTIONS))
@ -373,7 +373,7 @@ endif()
endif()
option(OQS_ENABLE_SIG_RAINBOW "" ON)
option(OQS_ENABLE_SIG_RAINBOW "Enable rainbow algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_SIG_rainbow_I_classic "" ON "OQS_ENABLE_SIG_RAINBOW" OFF)
cmake_dependent_option(OQS_ENABLE_SIG_rainbow_I_circumzenithal "" ON "OQS_ENABLE_SIG_RAINBOW" OFF)
cmake_dependent_option(OQS_ENABLE_SIG_rainbow_I_compressed "" ON "OQS_ENABLE_SIG_RAINBOW" OFF)
@ -384,7 +384,7 @@ cmake_dependent_option(OQS_ENABLE_SIG_rainbow_V_classic "" ON "OQS_ENABLE_SIG_RA
cmake_dependent_option(OQS_ENABLE_SIG_rainbow_V_circumzenithal "" ON "OQS_ENABLE_SIG_RAINBOW" OFF)
cmake_dependent_option(OQS_ENABLE_SIG_rainbow_V_compressed "" ON "OQS_ENABLE_SIG_RAINBOW" OFF)
option(OQS_ENABLE_SIG_SPHINCS "" ON)
option(OQS_ENABLE_SIG_SPHINCS "Enable sphincs algorithm family" ON)
cmake_dependent_option(OQS_ENABLE_SIG_sphincs_haraka_128f_robust "" ON "OQS_ENABLE_SIG_SPHINCS" OFF)
if(OQS_DIST_X86_64_BUILD OR (OQS_USE_AES_INSTRUCTIONS))
cmake_dependent_option(OQS_ENABLE_SIG_sphincs_haraka_128f_robust_aesni "" ON "OQS_ENABLE_SIG_sphincs_haraka_128f_robust" OFF)
@ -567,7 +567,7 @@ endif()
##### OQS_COPY_FROM_UPSTREAM_FRAGMENT_ADD_ENABLE_BY_ALG_END
if(OQS_MINIMAL_BUILD)
if(${OQS_MINIMAL_BUILD})
# Set every OQS_ENABLE_* variable =OFF unless it one of the following.
# 1. the switch for the default algorithm's family, e.g OQS_ENABLE_KEM_KYBER
# 2. the switch for the default algorithm, e.g. OQS_ENABLE_KEM_kyber_768.

View File

@ -13,7 +13,7 @@
# Otherwise we target the specified CPU.
set(OQS_OPT_FLAG "")
if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
if(OQS_DIST_BUILD)
if(${OQS_DIST_BUILD})
set(OQS_OPT_TARGET "generic")
endif()
@ -48,7 +48,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
add_compile_options(${OQS_OPT_FLAG})
# If this is not a dist build we also need to set the OQS_USE_[EXTENSION] flags
if(NOT OQS_DIST_BUILD)
if(NOT ${OQS_DIST_BUILD})
include(${CMAKE_CURRENT_LIST_DIR}/gcc_clang_intrinsics.cmake)
endif()
endif()
@ -60,13 +60,13 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wpedantic)
add_compile_options(-Wno-unused-command-line-argument)
if(NOT OQS_BUILD_ONLY_LIB)
if(NOT ${OQS_BUILD_ONLY_LIB})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(OQS_USE_PTHREADS_IN_TESTS 1)
endif()
if(OQS_DEBUG_BUILD)
if(${OQS_DEBUG_BUILD})
add_compile_options(-g3)
add_compile_options(-fno-omit-frame-pointer)
if(USE_SANITIZER STREQUAL "Address")
@ -110,13 +110,13 @@ elseif(CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wfloat-equal)
add_compile_options(-Wwrite-strings)
if(NOT OQS_BUILD_ONLY_LIB)
if(NOT ${OQS_BUILD_ONLY_LIB})
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(OQS_USE_PTHREADS_IN_TESTS 1)
endif()
if(OQS_DEBUG_BUILD)
if(${OQS_DEBUG_BUILD})
add_compile_options (-Wstrict-overflow)
add_compile_options(-ggdb3)
else()

View File

@ -65,7 +65,7 @@ jobs:
- checkout # change this from "checkout" to "*localCheckout" when running CircleCI locally
- run:
name: Configure
command: mkdir build && cd build && source ~/.bashrc && cmake -GNinja << parameters.CMAKE_ARGS >> -DOQS_MINIMAL_BUILD=ON -DOQS_KEM_DEFAULT=OQS_KEM_alg_<< parameters.KEM_NAME >> -DOQS_SIG_DEFAULT=OQS_SIG_alg_<< parameters.SIG_NAME >> .. && cmake -LA ..
command: mkdir build && cd build && source ~/.bashrc && cmake --warn-uninitialized -GNinja << parameters.CMAKE_ARGS >> -DOQS_MINIMAL_BUILD=ON -DOQS_KEM_DEFAULT=OQS_KEM_alg_<< parameters.KEM_NAME >> -DOQS_SIG_DEFAULT=OQS_SIG_alg_<< parameters.SIG_NAME >> .. > config.log 2>&1 && cat config.log && cmake -LA .. && ! (grep "uninitialized variable" config.log)
- run:
name: Build
command: ninja

View File

@ -17,6 +17,7 @@ project(liboqs C ASM)
option(OQS_DIST_BUILD "Build distributable library with optimized code for several CPU microarchitectures. Enables run-time CPU feature detection." OFF)
option(OQS_BUILD_ONLY_LIB "Build only liboqs and do not expose build targets for tests, documentation, and pretty-printing available." OFF)
option(OQS_MINIMAL_BUILD "Only build the default KEM and Signature schemes." OFF)
set(OQS_OPT_TARGET auto CACHE STRING "The target microarchitecture for optimization.")
set(CMAKE_C_STANDARD 11)
@ -30,29 +31,31 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
set(ARCH "x86_64")
set(ARCH_X86_64 ON)
if(OQS_DIST_BUILD)
if(${OQS_DIST_BUILD})
set(OQS_DIST_X86_64_BUILD ON)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|arm64v8")
set(ARCH "arm64v8")
set(ARCH_ARM64v8 ON)
if(OQS_DIST_BUILD)
if(${OQS_DIST_BUILD})
set(OQS_DIST_ARM64v8_BUILD ON)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armel|armhf|armv7|arm32v7")
set(ARCH "arm32v7")
set(ARCH_ARM32v7 ON)
if(OQS_DIST_BUILD)
if(${OQS_DIST_BUILD})
set(OQS_DIST_ARM32v7_BUILD ON)
endif()
else()
message(FATAL_ERROR "Unknown or unsupported processor: " ${CMAKE_SYSTEM_PROCESSOR})
endif()
# intentionally don't switch to variables to avoid --warn-uninitialized report
if(OQS_USE_CPU_EXTENSIONS)
message(FATAL_ERROR "OQS_USE_CPU_EXTENSIONS is deprecated")
endif()
# intentionally don't switch to variables to avoid --warn-uninitialized report
if(OQS_PORTABLE_BUILD)
message(FATAL_ERROR "OQS_PORTABLE_BUILD is deprecated")
endif()
@ -70,7 +73,7 @@ endif()
include(.CMake/compiler_opts.cmake)
include(.CMake/alg_support.cmake)
if(OQS_USE_OPENSSL)
if(${OQS_USE_OPENSSL})
if(NOT DEFINED OPENSSL_ROOT_DIR)
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl@1.1")
@ -91,16 +94,16 @@ set(PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/src/oqs.h
${PROJECT_SOURCE_DIR}/src/kem/kem.h
${PROJECT_SOURCE_DIR}/src/sig/sig.h)
if(OQS_ENABLE_KEM_BIKE)
if(${OQS_ENABLE_KEM_BIKE})
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/src/kem/bike/kem_bike.h)
endif()
if(OQS_ENABLE_KEM_FRODOKEM)
if(${OQS_ENABLE_KEM_FRODOKEM})
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/src/kem/frodokem/kem_frodokem.h)
endif()
if(OQS_ENABLE_KEM_SIKE OR OQS_ENABLE_KEM_SIDH)
if(${OQS_ENABLE_KEM_SIKE} OR ${OQS_ENABLE_KEM_SIDH})
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/src/kem/sike/kem_sike.h)
endif()
if(OQS_ENABLE_SIG_PICNIC)
if(${OQS_ENABLE_SIG_PICNIC})
set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ${PROJECT_SOURCE_DIR}/src/sig/picnic/sig_picnic.h)
endif()
##### OQS_COPY_FROM_UPSTREAM_FRAGMENT_INCLUDE_HEADERS_START
@ -143,7 +146,7 @@ set(PUBLIC_HEADERS ${PUBLIC_HEADERS} ${PROJECT_BINARY_DIR}/include/oqs/oqsconfig
include_directories(${PROJECT_BINARY_DIR}/include)
add_subdirectory(src)
if(NOT OQS_BUILD_ONLY_LIB)
if(NOT ${OQS_BUILD_ONLY_LIB})
add_subdirectory(tests)
if (NOT CYGWIN)

View File

@ -1,5 +1,5 @@
{% for family in instructions['kems'] %}
option(OQS_ENABLE_KEM_{{ family['name']|upper }} "" ON)
option(OQS_ENABLE_KEM_{{ family['name']|upper }} "Enable {{ family['name'] }} algorithm family" ON)
{%- for scheme in family['schemes'] %}
cmake_dependent_option(OQS_ENABLE_KEM_{{ family['name'] }}_{{ scheme['scheme'] }} "" ON "OQS_ENABLE_KEM_{{ family['name']|upper }}" OFF)
{%- for impl in scheme['metadata']['implementations'] if impl['name'] != family['default_implementation'] and impl['supported_platforms'] -%}
@ -17,7 +17,7 @@ endif()
{% endfor -%}
{% for family in instructions['sigs'] %}
option(OQS_ENABLE_SIG_{{ family['name']|upper }} "" ON)
option(OQS_ENABLE_SIG_{{ family['name']|upper }} "Enable {{ family['name'] }} algorithm family" ON)
{%- for scheme in family['schemes'] %}
cmake_dependent_option(OQS_ENABLE_SIG_{{ family['name'] }}_{{ scheme['scheme'] }} "" ON "OQS_ENABLE_SIG_{{ family['name']|upper }}" OFF)
{%- for impl in scheme['metadata']['implementations'] if impl['name'] != family['default_implementation'] and impl['supported_platforms'] -%}

View File

@ -2,21 +2,25 @@
add_subdirectory(common)
if(OQS_ENABLE_KEM_BIKE)
# initialize KEM|SIG_OBJS for --warn-uninitialized
set(KEM_OBJS "")
set(SIG_OBJS "")
if(${OQS_ENABLE_KEM_BIKE})
add_subdirectory(kem/bike)
set(KEM_OBJS ${BIKE_OBJS})
set(KEM_OBJS ${KEM_OBJS} ${BIKE_OBJS})
endif()
if(OQS_ENABLE_KEM_FRODOKEM)
if(${OQS_ENABLE_KEM_FRODOKEM})
add_subdirectory(kem/frodokem)
set(KEM_OBJS ${KEM_OBJS} ${FRODOKEM_OBJS})
endif()
if(OQS_ENABLE_KEM_SIKE OR OQS_ENABLE_KEM_SIDH)
if(${OQS_ENABLE_KEM_SIKE} OR ${OQS_ENABLE_KEM_SIDH})
add_subdirectory(kem/sike)
set(KEM_OBJS ${KEM_OBJS} $<TARGET_OBJECTS:sike>)
endif()
if(OQS_ENABLE_SIG_PICNIC)
if(${OQS_ENABLE_SIG_PICNIC})
add_subdirectory(sig/picnic)
set(SIG_OBJS $<TARGET_OBJECTS:picnic>)
set(SIG_OBJS ${SIG_OBJS} $<TARGET_OBJECTS:picnic>)
endif()
##### OQS_COPY_FROM_UPSTREAM_FRAGMENT_ADD_ALG_OBJECTS_START
if(OQS_ENABLE_KEM_CLASSIC_MCELIECE)
@ -70,7 +74,7 @@ set(COMMON_OBJS ${COMMON_OBJS} PARENT_SCOPE)
if(DEFINED SANITIZER_LD_FLAGS)
target_link_libraries(oqs PUBLIC ${SANITIZER_LD_FLAGS})
endif()
if(OQS_USE_OPENSSL)
if(${OQS_USE_OPENSSL})
target_link_libraries(oqs PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
target_include_directories(oqs PUBLIC ${OPENSSL_INCLUDE_DIR})
endif()

View File

@ -2,6 +2,9 @@
include(CheckSymbolExists)
# initialize to avoid --warn-uninitialized report
set(_COMMON_OBJS "")
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wbad-function-cast)
@ -12,7 +15,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wconversion)
endif()
if(OQS_USE_AES_OPENSSL)
if(${OQS_USE_AES_OPENSSL})
set(AES_IMPL aes/aes_ossl.c)
else()
set(AES_IMPL aes/aes.c aes/aes_c.c)
@ -24,13 +27,13 @@ else()
endif()
endif()
if(OQS_USE_SHA2_OPENSSL)
if(${OQS_USE_SHA2_OPENSSL})
set(SHA2_IMPL sha2/sha2_ossl.c)
else()
set(SHA2_IMPL sha2/sha2_c.c)
endif()
if(OQS_USE_SHA3_OPENSSL)
if(${OQS_USE_SHA3_OPENSSL})
set(SHA3_IMPL sha3/ossl_sha3.c sha3/ossl_sha3x4.c)
else() # using XKCP
add_subdirectory(sha3/xkcp_low)
@ -47,18 +50,16 @@ add_library(common OBJECT ${AES_IMPL}
rand/rand.c
rand/rand_nist.c)
if(OQS_USE_OPENSSL)
if(${OQS_USE_OPENSSL})
target_include_directories(common PRIVATE ${OPENSSL_INCLUDE_DIR})
endif()
if(NOT OQS_USE_OPENSSL)
else()
check_symbol_exists(getentropy "unistd.h;sys/random.h" CMAKE_HAVE_GETENTROPY)
if(${CMAKE_HAVE_GETENTROPY})
target_compile_definitions(common PRIVATE OQS_HAVE_GETENTROPY)
endif()
endif()
if(NOT OQS_USE_SHA3_OPENSSL) # using XKCP
if(NOT ${OQS_USE_SHA3_OPENSSL}) # using XKCP
set(_COMMON_OBJS ${_COMMON_OBJS} ${XKCP_LOW_OBJS})
endif()

View File

@ -21,14 +21,14 @@ if ( (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") OR
set(SRCS ${SRCS} additional/sampling_portable.c
additional/secure_decode_portable.c)
set(CPP_DEFS PORTABLE)
elseif(OQS_USE_AVX512_INSTRUCTIONS AND NOT OQS_DIST_BUILD)
elseif(OQS_USE_AVX512_INSTRUCTIONS AND NOT ${OQS_DIST_BUILD})
set(SRCS ${SRCS} additional/red.S
additional/secure_decode_avx512.c
additional/sampling_avx512.S
additional/gf_mul.S)
set(CPP_DEFS AVX512)
add_compile_options(-mavx512bw -mavx512dq -mavx512f)
elseif(OQS_USE_AVX2_INSTRUCTIONS AND NOT OQS_DIST_BUILD)
elseif(OQS_USE_AVX2_INSTRUCTIONS AND NOT ${OQS_DIST_BUILD})
set(SRCS ${SRCS} additional/red.S
additional/secure_decode_avx2.c
additional/sampling_avx2.S
@ -43,7 +43,7 @@ endif()
add_compile_options(-include ${CMAKE_CURRENT_LIST_DIR}/functions_renaming.h)
if(OQS_USE_OPENSSL)
if(${OQS_USE_OPENSSL})
# TODO: Find a way to eliminate this include_directories() call
include_directories(${OPENSSL_INCLUDE_DIR})
set(SRCS ${SRCS} additional/openssl_utils.c)
@ -60,7 +60,7 @@ add_library(kem_bike OBJECT kem_bike.c)
set(_BIKE_OBJS $<TARGET_OBJECTS:kem_bike>)
# CPA variants
if(OQS_ENABLE_KEM_bike1_l1_cpa)
if(${OQS_ENABLE_KEM_bike1_l1_cpa})
add_library(bike1_l1_cpa OBJECT ${SRCS} additional/kem_cpa.c)
target_compile_definitions(bike1_l1_cpa PRIVATE INDCPA=1 LEVEL=1 FUNC_PREFIX=OQS_KEM_bike1_l1_cpa ${CPP_DEFS})
set(_BIKE_OBJS ${_BIKE_OBJS} $<TARGET_OBJECTS:bike1_l1_cpa>)