Skip to content

Commit c8666fa

Browse files
levittebeldmit
authored andcommitted
Cleanup source organisation, and make 'gost' an actual module
GOST_CORE_SOURCE_FILES and GOST_ENGINE_SOURCE_FILES were a bit disorganised, they are now re-arranged so GOST_ENGINE_SOURCE_FILES contains ENGINE specific source only, and what was less ENGINE specific was moved to GOST_CORE_SOURCE_FILES. Furthermore, GOST_LIB_SOURCE_FILES now includes GOST_CORE_SOURCE_FILES, so the gost_core library is complete with all implementations. As a consequence, 'gost' is now explicitly made into a dlopenable module. On some operating systems, that makes a difference. This paves the way for alternative implementations based on the same base code, such as a provider implementation. It's quite possible that the re-arrangement done here isn't "pure" enough. Future development will tell.
1 parent 57d48a7 commit c8666fa

File tree

1 file changed

+22
-26
lines changed

1 file changed

+22
-26
lines changed

CMakeLists.txt

+22-26
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ endif()
8080

8181
set(BIN_DIRECTORY bin)
8282

83-
# Same soversion as OpenSSL
84-
set(GOST_SOVERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}")
85-
8683
set(OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${BIN_DIRECTORY})
8784

8885
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIRECTORY})
@@ -134,12 +131,18 @@ set(GOST_GRASSHOPPER_SOURCE_FILES
134131
set(GOST_CORE_SOURCE_FILES
135132
e_gost_err.c
136133
e_gost_err.h
134+
gost_ameth.c
135+
gost_pmeth.c
136+
gost_ctl.c
137137
gost_asn1.c
138138
gost_crypt.c
139-
gost_ctl.c
140-
gost_eng.c
141139
gost_keywrap.c
142140
gost_keywrap.h
141+
gost_md.c
142+
gost_md2012.c
143+
gost_omac.c
144+
gost_omac_acpkm.c
145+
gost_gost2015.c
143146
gost_lcl.h
144147
gost_params.c
145148
gost_keyexpimp.c
@@ -164,6 +167,7 @@ set (GOST_OMAC_SOURCE_FILES
164167
)
165168

166169
set(GOST_LIB_SOURCE_FILES
170+
${GOST_CORE_SOURCE_FILES}
167171
${GOST_89_SOURCE_FILES}
168172
${GOST_HASH_SOURCE_FILES}
169173
${GOST_HASH_2012_SOURCE_FILES}
@@ -173,64 +177,57 @@ set(GOST_LIB_SOURCE_FILES
173177
)
174178

175179
set(GOST_ENGINE_SOURCE_FILES
176-
${GOST_CORE_SOURCE_FILES}
177-
gost_ameth.c
178-
gost_md.c
179-
gost_md2012.c
180-
gost_pmeth.c
181-
gost_omac.c
182-
gost_omac_acpkm.c
183-
gost_gost2015.c
180+
gost_eng.c
184181
)
185182

186183
add_executable(test_digest test_digest.c)
187-
target_link_libraries(test_digest gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
184+
target_link_libraries(test_digest gost_core ${OPENSSL_CRYPTO_LIBRARY})
188185
add_test(NAME digest
189186
COMMAND test_digest)
190187

191188
add_executable(test_ciphers test_ciphers.c)
192-
target_link_libraries(test_ciphers gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
189+
target_link_libraries(test_ciphers gost_core ${OPENSSL_CRYPTO_LIBRARY})
193190
add_test(NAME ciphers
194191
COMMAND test_ciphers)
195192

196193
add_executable(test_curves test_curves.c)
197-
target_link_libraries(test_curves gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
194+
target_link_libraries(test_curves gost_core ${OPENSSL_CRYPTO_LIBRARY})
198195
add_test(NAME curves
199196
COMMAND test_curves)
200197

201198
add_executable(test_params test_params.c)
202-
target_link_libraries(test_params gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
199+
target_link_libraries(test_params gost_core ${OPENSSL_CRYPTO_LIBRARY})
203200
add_test(NAME parameters
204201
COMMAND test_params)
205202

206203
add_executable(test_derive test_derive.c)
207-
target_link_libraries(test_derive gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
204+
target_link_libraries(test_derive gost_core ${OPENSSL_CRYPTO_LIBRARY})
208205
add_test(NAME derive
209206
COMMAND test_derive)
210207

211208
add_executable(test_sign test_sign.c)
212-
target_link_libraries(test_sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
209+
target_link_libraries(test_sign gost_core ${OPENSSL_CRYPTO_LIBRARY})
213210
add_test(NAME sign/verify
214211
COMMAND test_sign)
215212

216213
add_executable(test_tls test_tls.c)
217-
target_link_libraries(test_tls gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
214+
target_link_libraries(test_tls gost_core ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
218215
add_test(NAME TLS
219216
COMMAND test_tls)
220217

221218
add_executable(test_context test_context.c)
222-
target_link_libraries(test_context gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
219+
target_link_libraries(test_context gost_core ${OPENSSL_CRYPTO_LIBRARY})
223220
add_test(NAME context
224221
COMMAND test_context)
225222

226223
add_executable(test_keyexpimp test_keyexpimp.c)
227224
#target_compile_definitions(test_keyexpimp PUBLIC -DOPENSSL_LOAD_CONF)
228-
target_link_libraries(test_keyexpimp gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
225+
target_link_libraries(test_keyexpimp gost_core ${OPENSSL_CRYPTO_LIBRARY})
229226
add_test(NAME keyexpimp
230227
COMMAND test_keyexpimp)
231228

232229
add_executable(test_gost89 test_gost89.c)
233-
target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
230+
target_link_libraries(test_gost89 gost_core ${OPENSSL_CRYPTO_LIBRARY})
234231
add_test(NAME gost89
235232
COMMAND test_gost89)
236233

@@ -249,7 +246,7 @@ if(NOT SKIP_PERL_TESTS)
249246
endif()
250247

251248
add_executable(sign benchmark/sign.c)
252-
target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})
249+
target_link_libraries(sign gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})
253250

254251
# All that may need to load just built engine will have path to it defined.
255252
set(BINARY_TESTS_TARGETS
@@ -269,9 +266,8 @@ set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS
269266
add_library(gost_core STATIC ${GOST_LIB_SOURCE_FILES})
270267
set_target_properties(gost_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
271268

272-
add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES})
269+
add_library(gost_engine MODULE ${GOST_ENGINE_SOURCE_FILES})
273270
set_target_properties(gost_engine PROPERTIES PREFIX "" OUTPUT_NAME "gost")
274-
set_target_properties(gost_engine PROPERTIES VERSION ${GOST_SOVERSION} SOVERSION ${GOST_SOVERSION})
275271
target_link_libraries(gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
276272

277273
set(GOST_SUM_SOURCE_FILES

0 commit comments

Comments
 (0)