]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Separate GOST engine and GOST library, make GOST engine a module
authorRichard Levitte <richard@levitte.org>
Mon, 26 Jun 2017 07:46:11 +0000 (09:46 +0200)
committerRichard Levitte <richard@levitte.org>
Mon, 26 Jun 2017 07:50:03 +0000 (09:50 +0200)
The GOST engine is a dynamically loadable module rather than a shared
library, so make that explicit.  However, the programs gost12sum,
gostsum and gostsum12 need to link against the algorithms implemented
as part of the engine, so separate those out into a static library
that both programs and engine link with.

CMakeLists.txt

index 4b50a42539c22df39c8b4b6c68c271f4db713ff4..285bc2fb2466c44f8a44e5c37f4db6d09914bce0 100644 (file)
@@ -24,7 +24,7 @@ set(BIN_DIRECTORY bin)
 
 set(OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/${BIN_DIRECTORY})
 
-set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
+#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
 
@@ -80,23 +80,28 @@ set(GOST_EC_SOURCE_FILES
         gost_ec_sign.c
         )
 
-set(GOST_ENGINE_SOURCE_FILES
-        ${GOST_CORE_SOURCE_FILES}
+set(GOST_LIB_SOURCE_FILES
         ${GOST_EC_SOURCE_FILES}
         ${GOST_89_SOURCE_FILES}
-        gost_ameth.c
-        gost_md.c
-        gost_md2012.c
-        gost_pmeth.c
         ${GOST_HASH_SOURCE_FILES}
         ${GOST_GRASSHOPPER_SOURCE_FILES}
         ${GOST_HASH_2012_SOURCE_FILES})
 
+set(GOST_ENGINE_SOURCE_FILES
+        ${GOST_CORE_SOURCE_FILES}
+        gost_ameth.c
+        gost_md.c
+        gost_md2012.c
+        gost_pmeth.c)
+
 link_directories(${GOST_LINK_DIRECTORIES})
 
-add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES})
+add_library(gost STATIC ${GOST_LIB_SOURCE_FILES})
+set_target_properties(gost PROPERTIES POSITION_INDEPENDENT_CODE ON)
+
+add_library(gost_engine MODULE ${GOST_ENGINE_SOURCE_FILES})
 
-target_link_libraries(gost_engine crypto)
+target_link_libraries(gost_engine crypto gost)
 
 set(GOST_12_SUM_SOURCE_FILES
         gost12sum.c
@@ -104,7 +109,7 @@ set(GOST_12_SUM_SOURCE_FILES
 
 add_executable(gost12sum ${GOST_12_SUM_SOURCE_FILES})
 
-target_link_libraries(gost12sum gost_engine)
+target_link_libraries(gost12sum gost)
 
 set(GOST_SUM_SOURCE_FILES
         gostsum.c
@@ -112,7 +117,7 @@ set(GOST_SUM_SOURCE_FILES
 
 add_executable(gostsum ${GOST_SUM_SOURCE_FILES})
 
-target_link_libraries(gostsum gost_engine)
+target_link_libraries(gostsum gost)
 
 set(GOST_SUM_12_SOURCE_FILES
         gostsum12.c
@@ -120,4 +125,4 @@ set(GOST_SUM_12_SOURCE_FILES
 
 add_executable(gostsum12 ${GOST_SUM_12_SOURCE_FILES})
 
-target_link_libraries(gostsum12 gost_engine)
+target_link_libraries(gostsum12 gost)