|
| 1 | +cmake_minimum_required(VERSION 3.4) |
| 2 | +project(ccgost) |
| 3 | + |
| 4 | +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c98 -O3") |
| 5 | + |
| 6 | +set(GOST_INCLUDE_DIRECTORIES "${OPENSSL_PATH}/include" "${OPENSSL_PATH}/crypto/include") |
| 7 | + |
| 8 | +set(GOST_LINK_DIRECTORIES "${OPENSSL_PATH}") |
| 9 | + |
| 10 | +include_directories("${GOST_INCLUDE_DIRECTORIES}") |
| 11 | + |
| 12 | +set(BIN_DIRECTORY bin) |
| 13 | + |
| 14 | +set(OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${BIN_DIRECTORY}) |
| 15 | + |
| 16 | +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}) |
| 17 | +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}) |
| 18 | +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY}) |
| 19 | + |
| 20 | +set(GOST_89_SOURCE_FILES |
| 21 | + gost89.c |
| 22 | + gost89.h |
| 23 | + ) |
| 24 | + |
| 25 | +set(GOST_HASH_SOURCE_FILES |
| 26 | + gosthash.c |
| 27 | + gosthash.h |
| 28 | + ) |
| 29 | + |
| 30 | +set(GOST_HASH_2012_SOURCE_FILES |
| 31 | + gosthash2012.c |
| 32 | + gosthash2012.h |
| 33 | + gosthash2012_const.h |
| 34 | + gosthash2012_precalc.h |
| 35 | + gosthash2012_ref.h |
| 36 | + gosthash2012_sse2.h |
| 37 | + ) |
| 38 | + |
| 39 | +set(GOST_GRASSHOPPER_SOURCE_FILES |
| 40 | + gost_grasshopper.h |
| 41 | + gost_grasshopper_core.h |
| 42 | + gost_grasshopper_core.c |
| 43 | + gost_grasshopper_defines.h |
| 44 | + gost_grasshopper_defines.c |
| 45 | + gost_grasshopper_math.h |
| 46 | + gost_grasshopper_galois_precompiled.c |
| 47 | + gost_grasshopper_precompiled.c |
| 48 | + gost_grasshopper_cipher.h |
| 49 | + gost_grasshopper_cipher.c |
| 50 | + gost_grasshopper_mac.h |
| 51 | + gost_grasshopper_mac.c |
| 52 | + ) |
| 53 | + |
| 54 | +set(GOST_CORE_SOURCE_FILES |
| 55 | + e_gost_err.c |
| 56 | + e_gost_err.h |
| 57 | + gost_asn1.c |
| 58 | + gost_crypt.c |
| 59 | + gost_ctl.c |
| 60 | + gost_eng.c |
| 61 | + gost_keywrap.c |
| 62 | + gost_keywrap.h |
| 63 | + gost_lcl.h |
| 64 | + gost_params.c |
| 65 | + ) |
| 66 | + |
| 67 | +set(GOST_EC_SOURCE_FILES |
| 68 | + gost_ec_keyx.c |
| 69 | + gost_ec_sign.c |
| 70 | + ) |
| 71 | + |
| 72 | +set(GOST_ENGINE_SOURCE_FILES |
| 73 | + ${GOST_CORE_SOURCE_FILES} |
| 74 | + ${GOST_EC_SOURCE_FILES} |
| 75 | + ${GOST_89_SOURCE_FILES} |
| 76 | + gost_ameth.c |
| 77 | + gost_md.c |
| 78 | + gost_md2012.c |
| 79 | + gost_pmeth.c |
| 80 | + ${GOST_HASH_SOURCE_FILES} |
| 81 | + ${GOST_GRASSHOPPER_SOURCE_FILES} |
| 82 | + ${GOST_HASH_2012_SOURCE_FILES}) |
| 83 | + |
| 84 | +link_directories(${GOST_LINK_DIRECTORIES}) |
| 85 | + |
| 86 | +add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES}) |
| 87 | + |
| 88 | +target_link_libraries(gost_engine crypto) |
| 89 | + |
| 90 | +set(GOST_12_SUM_SOURCE_FILES |
| 91 | + gost12sum.c |
| 92 | + ) |
| 93 | + |
| 94 | +add_executable(gost12sum ${GOST_12_SUM_SOURCE_FILES}) |
| 95 | + |
| 96 | +target_link_libraries(gost12sum gost_engine) |
| 97 | + |
| 98 | +set(GOST_SUM_SOURCE_FILES |
| 99 | + gostsum.c |
| 100 | + ) |
| 101 | + |
| 102 | +add_executable(gostsum ${GOST_SUM_SOURCE_FILES}) |
| 103 | + |
| 104 | +target_link_libraries(gostsum gost_engine) |
| 105 | + |
| 106 | +set(GOST_SUM_12_SOURCE_FILES |
| 107 | + gostsum12.c |
| 108 | + ) |
| 109 | + |
| 110 | +add_executable(gostsum12 ${GOST_SUM_12_SOURCE_FILES}) |
| 111 | + |
| 112 | +target_link_libraries(gostsum12 gost_engine) |
0 commit comments