]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
WIP: Made changes to be able to build gost-engine as static library. Added gost-engin...
authorkartaris <rust768@gmail.com>
Tue, 17 Aug 2021 08:29:23 +0000 (11:29 +0300)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Fri, 20 Aug 2021 13:22:58 +0000 (16:22 +0300)
Made gost_core library independent.
Corrected openssl version in cirrus.yml
Related issue: #340

.cirrus.yml
CMakeLists.txt
gost-engine.h [new file with mode: 0644]

index 6e04657785adadd1f2299ad054e8dd44e4005caa..e718e858210f3497a7a5d944b8f8c33029e93698 100644 (file)
@@ -4,7 +4,7 @@ FreeBSD_task:
   env:
     PREFIX: ${HOME}/opt
     PATH: ${PREFIX}/bin:${PATH}
-    OPENSSL_BRANCH: master
+    OPENSSL_BRANCH: OpenSSL_1_1_1
   install_script:
     - pkg install -y git cmake p5-App-cpanminus gdb pkgconf
     - sudo cpanm --notest Test2::V0
index e6337c9e04709309605625169247dd6b77fddfec..2af32486ff43b7dec27e6e77b3152e24e97429f8 100644 (file)
@@ -138,11 +138,8 @@ set(GOST_CORE_SOURCE_FILES
         gost_crypt.c
         gost_ctl.c
         gost_eng.c
-        gost_keywrap.c
-        gost_keywrap.h
         gost_lcl.h
         gost_params.c
-        gost_keyexpimp.c
         )
 
 set(GOST_EC_SOURCE_FILES
@@ -170,6 +167,9 @@ set(GOST_LIB_SOURCE_FILES
         ${GOST_GRASSHOPPER_SOURCE_FILES}
         ${GOST_EC_SOURCE_FILES}
         ${GOST_OMAC_SOURCE_FILES}
+        gost_keyexpimp.c
+        gost_keywrap.c
+        gost_keywrap.h
         )
 
 set(GOST_ENGINE_SOURCE_FILES
@@ -183,48 +183,48 @@ set(GOST_ENGINE_SOURCE_FILES
         )
 
 add_executable(test_digest test_digest.c)
-target_link_libraries(test_digest gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY})
+target_link_libraries(test_digest gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_curves gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_params gost_engine gost_core dl z pthread)
 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})
+target_link_libraries(test_sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_tls ${OPENSSL_CRYPTO_LIBRARY} ${OPENSSL_SSL_LIBRARY} dl z pthread gost_engine gost_core)
 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})
+target_link_libraries(test_context gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_grasshopper gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_keyexpimp gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 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})
+target_link_libraries(test_gost89 gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 add_test(NAME gost89
        COMMAND test_gost89)
 
@@ -243,7 +243,7 @@ if(NOT SKIP_PERL_TESTS)
 endif()
 
 add_executable(sign benchmark/sign.c)
-target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB})
+target_link_libraries(sign gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARY} ${CLOCK_GETTIME_LIB} dl z pthread)
 
 # All that may need to load just built engine will have path to it defined.
 set(BINARY_TESTS_TARGETS
@@ -267,12 +267,17 @@ 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_static STATIC ${GOST_ENGINE_SOURCE_FILES})
+set_target_properties(gost_engine_static PROPERTIES PREFIX "lib" PUBLIC_HEADER gost-engine.h OUTPUT_NAME "gost")
+target_link_libraries(gost_engine_static gost_core ${OPENSSL_CRYPTO_LIBRARY} dl pthread z)
+
+
 set(GOST_SUM_SOURCE_FILES
         gostsum.c
         )
 
 add_executable(gostsum ${GOST_SUM_SOURCE_FILES})
-target_link_libraries(gostsum gost_core ${OPENSSL_CRYPTO_LIBRARY})
+target_link_libraries(gostsum gost_core ${OPENSSL_CRYPTO_LIBRARY} dl z pthread)
 
 set(GOST_12_SUM_SOURCE_FILES
         gost12sum.c
diff --git a/gost-engine.h b/gost-engine.h
new file mode 100644 (file)
index 0000000..da292c3
--- /dev/null
@@ -0,0 +1,14 @@
+/**********************************************************************
+ *                            gost-engine.h                           *
+ *                     GOST engine in library form                    *
+ *                                                                    *
+ *      Copyright (c) 2021 Richard Levitte <richard@levitte.org>      *
+ *     This file is distributed under the same license as OpenSSL     *
+ *                                                                    *
+ **********************************************************************/
+#ifndef GOST_ENGINE_H
+# define GOST_ENGINE_H
+
+void ENGINE_load_gost(void);
+
+#endif