Skip to content

Commit

Permalink
Start converting the engine to provider
Browse files Browse the repository at this point in the history
  • Loading branch information
beldmit committed Nov 9, 2019
1 parent a803e98 commit 011e15b
Show file tree
Hide file tree
Showing 4 changed files with 164 additions and 205 deletions.
134 changes: 67 additions & 67 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,51 +139,51 @@ set(GOST_ENGINE_SOURCE_FILES
set(GOST_PROVIDER_SOURCE_FILES
gost_prov.c)

add_executable(test_digest test_digest.c)
target_link_libraries(test_digest gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME digest
COMMAND test_digest)

add_executable(test_curves test_curves.c)
target_link_libraries(test_curves gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME curves
COMMAND test_curves)

add_executable(test_params test_params.c)
target_link_libraries(test_params gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME parameters
COMMAND test_params)

add_executable(test_sign test_sign.c)
target_link_libraries(test_sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME sign/verify
COMMAND test_sign)

add_executable(test_tls test_tls.c)
target_link_libraries(test_tls gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
add_test(NAME TLS
COMMAND test_tls)

add_executable(test_context test_context.c)
target_link_libraries(test_context gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME context
COMMAND test_context)

add_executable(test_grasshopper test_grasshopper.c)
target_link_libraries(test_grasshopper gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME grasshopper
COMMAND test_grasshopper)

add_executable(test_keyexpimp test_keyexpimp.c)
#target_compile_definitions(test_keyexpimp PUBLIC -DOPENSSL_LOAD_CONF)
target_link_libraries(test_keyexpimp gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME keyexpimp
COMMAND test_keyexpimp)

add_executable(test_gost89 test_gost89.c)
target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
add_test(NAME gost89
COMMAND test_gost89)
#add_executable(test_digest test_digest.c)
#target_link_libraries(test_digest gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME digest
# COMMAND test_digest)
#
#add_executable(test_curves test_curves.c)
#target_link_libraries(test_curves gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME curves
# COMMAND test_curves)
#
#add_executable(test_params test_params.c)
#target_link_libraries(test_params gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME parameters
# COMMAND test_params)
#
#add_executable(test_sign test_sign.c)
#target_link_libraries(test_sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME sign/verify
# COMMAND test_sign)
#
#add_executable(test_tls test_tls.c)
#target_link_libraries(test_tls gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY})
#add_test(NAME TLS
# COMMAND test_tls)
#
#add_executable(test_context test_context.c)
#target_link_libraries(test_context gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME context
# COMMAND test_context)
#
#add_executable(test_grasshopper test_grasshopper.c)
#target_link_libraries(test_grasshopper gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME grasshopper
# COMMAND test_grasshopper)
#
#add_executable(test_keyexpimp test_keyexpimp.c)
##target_compile_definitions(test_keyexpimp PUBLIC -DOPENSSL_LOAD_CONF)
#target_link_libraries(test_keyexpimp gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME keyexpimp
# COMMAND test_keyexpimp)
#
#add_executable(test_gost89 test_gost89.c)
#target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_test(NAME gost89
# COMMAND test_gost89)

if(NOT ASAN)
add_test(NAME engine
Expand All @@ -193,32 +193,32 @@ set_tests_properties(engine PROPERTIES ENVIRONMENT
"OPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR};OPENSSL_ENGINES=${OUTPUT_DIRECTORY};OPENSSL_CONF=${CMAKE_SOURCE_DIR}/test/empty.cnf")
endif()

add_executable(sign benchmark/sign.c)
target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})

# All that may need to load just built engine will have path to it defined.
set(BINARY_TESTS_TARGETS
test_digest
test_curves
test_params
test_sign
test_context
test_grasshopper
test_keyexpimp
test_gost89
test_tls
)
set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS ENGINE_DIR="${OUTPUT_DIRECTORY}")
#add_executable(sign benchmark/sign.c)
#target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})
#
## All that may need to load just built engine will have path to it defined.
#set(BINARY_TESTS_TARGETS
# test_digest
# test_curves
# test_params
# test_sign
# test_context
# test_grasshopper
# test_keyexpimp
# test_gost89
# test_tls
# )
#set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS ENGINE_DIR="${OUTPUT_DIRECTORY}")

add_library(gost_core STATIC ${GOST_LIB_SOURCE_FILES})
set_target_properties(gost_core PROPERTIES POSITION_INDEPENDENT_CODE ON)

add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES})
set_target_properties(gost_engine PROPERTIES PREFIX "" OUTPUT_NAME "gost")
set_target_properties(gost_engine PROPERTIES VERSION ${GOST_SOVERSION} SOVERSION ${GOST_SOVERSION})
target_link_libraries(gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
#add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES})
#set_target_properties(gost_engine PROPERTIES PREFIX "" OUTPUT_NAME "gost")
#set_target_properties(gost_engine PROPERTIES VERSION ${GOST_SOVERSION} SOVERSION ${GOST_SOVERSION})
#target_link_libraries(gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})

add_library(gost_provider SHARED ${GOST_PROVIDER_SOURCE_FILES})
add_library(gost_provider SHARED ${GOST_PROVIDER_SOURCE_FILES} ${GOST_ENGINE_SOURCE_FILES})
set_target_properties(gost_provider PROPERTIES PREFIX "" OUTPUT_NAME "gost_prov")
set_target_properties(gost_provider PROPERTIES VERSION ${GOST_SOVERSION} SOVERSION ${GOST_SOVERSION})
target_link_libraries(gost_provider gost_core ${OPENSSL_CRYPTO_LIBRARY})
Expand Down Expand Up @@ -248,7 +248,7 @@ target_link_libraries(test_tlstree PUBLIC ${OPENSSL_CRYPTO_LIBRARY})
# install
set(OPENSSL_MAN_INSTALL_DIR ${CMAKE_INSTALL_MANDIR}/man1)

install(TARGETS gost_engine gostsum gost12sum EXPORT GostEngineConfig
install(TARGETS gost_provider gostsum gost12sum EXPORT GostEngineConfig
LIBRARY DESTINATION ${OPENSSL_ENGINES_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES gostsum.1 gost12sum.1 DESTINATION ${OPENSSL_MAN_INSTALL_DIR})
Expand Down
Loading

0 comments on commit 011e15b

Please sign in to comment.