X-Git-Url: http://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=CMakeLists.txt;h=a83d19ddfd139c57b6a1765afe740fad07f0e765;hb=bdd018198b30328b39a82108efc0d13065888dda;hp=1dd02c96ed773735f9d3bcbef7936c4a98e19783;hpb=bc346202fbb3bc838a19af8c3b0e449926589c7b;p=openssl-gost%2Fengine.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dd02c9..a83d19d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,13 +8,13 @@ include(CheckCSourceRuns) enable_testing() -find_package(OpenSSL 3.0 REQUIRED) +find_package(OpenSSL 1.1.1 REQUIRED) include_directories(${OPENSSL_INCLUDE_DIR}) if (CMAKE_C_COMPILER_ID MATCHES "Clang") - add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Qunused-arguments) + add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Qunused-arguments -Wno-deprecated-declarations) elseif(CMAKE_C_COMPILER_ID MATCHES "GNU") - add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas -Wno-deprecated-declarations) + add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-error=unknown-pragmas -Wno-deprecated-declarations) elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS) @@ -22,6 +22,12 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC") add_compile_options(/MP /WX /W4 /wd4100 /wd4267 /wd4206 /wd4706 /wd4244 /wd4115) endif() +string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type) +if (build_type STREQUAL debug) + message(STATUS "Debug build") + add_compile_options(-ggdb) +endif() + if (ASAN) message(STATUS "address sanitizer enabled") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g3 -fno-omit-frame-pointer") @@ -66,6 +72,18 @@ if (ADDCARRY_U64) add_definitions(-DHAVE_ADDCARRY_U64) endif() +check_c_source_runs(" + int main(void) { + char buf[16] = { 0, 1, 2 }; + int *p = buf + 1; + int *q = buf + 2; + return (*p == *q); + } + " RELAXED_ALIGNMENT) +if (NOT RELAXED_ALIGNMENT) + add_definitions(-DSTRICT_ALIGNMENT) +endif() + set(BIN_DIRECTORY bin) # Same soversion as OpenSSL @@ -191,6 +209,11 @@ target_link_libraries(test_params gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY add_test(NAME parameters COMMAND test_params) +add_executable(test_derive test_derive.c) +target_link_libraries(test_derive gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY}) +add_test(NAME derive + COMMAND test_derive) + add_executable(test_sign test_sign.c) target_link_libraries(test_sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY}) add_test(NAME sign/verify @@ -217,6 +240,11 @@ target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY add_test(NAME gost89 COMMAND test_gost89) +add_executable(test_mgm test_mgm.c) +target_link_libraries(test_mgm gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY}) +add_test(NAME mgm + COMMAND test_mgm) + if(NOT SKIP_PERL_TESTS) execute_process(COMMAND perl -MTest2::V0 -e "" ERROR_QUIET RESULT_VARIABLE HAVE_TEST2_V0) @@ -240,11 +268,13 @@ set(BINARY_TESTS_TARGETS test_ciphers test_curves test_params + test_derive test_sign test_context test_keyexpimp test_gost89 test_tls + test_mgm ) set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS ENGINE_DIR="${OUTPUT_DIRECTORY}")