]> www.wagner.pp.ru Git - openssl-gost/engine.git/blobdiff - CMakeLists.txt
Destroy GOST key data with OPENSSL_cleanse()
[openssl-gost/engine.git] / CMakeLists.txt
index 407302b452dc500a7891b8f63e12f775c0eb6393..4c069700e334a14526f36050097444044f44abcb 100644 (file)
@@ -4,6 +4,7 @@ project(gost-engine LANGUAGES C)
 include(GNUInstallDirs)
 include(CheckLibraryExists)
 include(CheckFunctionExists)
+include(CheckCSourceRuns)
 
 enable_testing()
 
@@ -13,7 +14,7 @@ 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)
 elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
- add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb)
+ add_compile_options(-O2 -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -ggdb -Wno-error=unknown-pragmas)
 elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC")
  add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  add_definitions(-D_CRT_DEPRECATED_NO_WARNINGS)
@@ -26,6 +27,11 @@ if (ASAN)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -g3 -fno-omit-frame-pointer")
 endif()
 
+# DEPRECATEDIN_3_0 CMAC
+set_source_files_properties(gost_omac.c PROPERTIES COMPILE_FLAGS -Wno-error=deprecated-declarations)
+# DEPRECATEDIN_3_0 HMAC
+set_source_files_properties(gost_keyexpimp.c PROPERTIES COMPILE_FLAGS -Wno-error=deprecated-declarations)
+
 set(CMAKE_C_STANDARD 90)
 CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME_C)
 CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME_RT)
@@ -42,6 +48,23 @@ else()
  add_definitions(-DL_ENDIAN)
 endif()
 
+check_c_source_runs("
+  #ifdef _MSC_VER
+  # include <intrin.h>
+  #else
+  # include <x86intrin.h>
+  #endif
+  int main(void) {
+    unsigned long long x = -1, y = 1, r;
+    unsigned char cf;
+    cf = _addcarry_u64(1, x, y, &r);
+    return !(cf == 1 && r == 1);
+  }
+  " ADDCARRY_U64)
+if (ADDCARRY_U64)
+  add_definitions(-DHAVE_ADDCARRY_U64)
+endif()
+
 set(BIN_DIRECTORY bin)
 
 # Same soversion as OpenSSL
@@ -222,7 +245,7 @@ set(GOST_SUM_SOURCE_FILES
         )
 
 add_executable(gostsum ${GOST_SUM_SOURCE_FILES})
-target_link_libraries(gostsum gost_core)
+target_link_libraries(gostsum gost_core ${OPENSSL_CRYPTO_LIBRARY})
 
 set(GOST_12_SUM_SOURCE_FILES
         gost12sum.c
@@ -236,6 +259,10 @@ add_custom_target(tags
     COMMAND ctags -R . ${OPENSSL_ROOT_DIR}
     WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
 
+add_custom_target(tcl_tests
+    COMMAND ENGINE_DIR=${OUTPUT_DIRECTORY} sh ./runtest.sh
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tcl_tests)
+
 add_executable(test_tlstree test_tlstree.c)
 target_link_libraries(test_tlstree PUBLIC ${OPENSSL_CRYPTO_LIBRARY})