gost_engine: add version 3.0.0.1

With OpenSSL soon to be updated to 3.0, the gost engine will have to be
bumped as well.  Gost 3.0.0.1 will not build with OpenSSL 1.1.

To avoid disruption, this commit detects the OpenSSL version from
ENGINES_DIR in include/openssl-engin, and sets the package version
accordingly.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
This commit is contained in:
Eneas U de Queiroz 2023-02-09 10:52:59 -03:00
parent 70009d3586
commit ab6fbdc44a
No known key found for this signature in database
GPG Key ID: 5FB9FAF260B80AEA
4 changed files with 128 additions and 5 deletions

View File

@ -1,19 +1,27 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/openssl-engine.mk
PKG_NAME:=gost_engine
PKG_VERSION:=1.1.0.3
PKG_RELEASE:=$(AUTORELEASE)
ifeq ($(ENGINES_DIR),engines-1.1)
PKG_VERSION:=1.1.0.3
PKG_HASH:=fff725052e82c9adb5b738729b30141f61ac91fa457a4f4b5de18b8b24092f75
PKG_LICENSE:=OpenSSL
PATCH_DIR=./patches-1.1
else
PKG_VERSION:=3.0.1
PKG_HASH:=bfeac85883724cfbe0ecc6d942ac0524b908143e019ab3d3b6abe47a3466a628
PKG_LICENSE:=Apache-2.0
PATCH_DIR=./patches-3
endif
PKG_RELEASE:=7
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/gost-engine/engine/archive/v$(PKG_VERSION)
PKG_HASH:=fff725052e82c9adb5b738729b30141f61ac91fa457a4f4b5de18b8b24092f75
PKG_MAINTAINER:=Artur Petrov <github@phpchain.ru>
PKG_LICENSE:=OpenSSL
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
include $(INCLUDE_DIR)/openssl-engine.mk
PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
PKG_INSTALL:=

View File

@ -0,0 +1,59 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,31 +64,35 @@ else()
add_definitions(-DL_ENDIAN)
endif()
-check_c_source_runs("
- #ifdef _MSC_VER
- # include <intrin.h>
- #else
- # include <x86intrin.h>
- #endif
- int main(void) {
- unsigned long long x = -1, y = 1, r;
- unsigned char cf;
- cf = _addcarry_u64(1, x, y, &r);
- return !(cf == 1 && r == 1);
- }
- " ADDCARRY_U64)
+if(NOT CMAKE_CROSSCOMPILING)
+ check_c_source_runs("
+ #ifdef _MSC_VER
+ # include <intrin.h>
+ #else
+ # include <x86intrin.h>
+ #endif
+ int main(void) {
+ unsigned long long x = -1, y = 1, r;
+ unsigned char cf;
+ cf = _addcarry_u64(1, x, y, &r);
+ return !(cf == 1 && r == 1);
+ }
+ " ADDCARRY_U64)
+
+ check_c_source_runs("
+ int main(void) {
+ char buf[16] = { 0, 1, 2 };
+ int *p = (int *)(buf + 1);
+ int *q = (int *)(buf + 2);
+ return (*p == *q);
+ }
+ " RELAXED_ALIGNMENT)
+endif()
+
if (ADDCARRY_U64)
add_definitions(-DHAVE_ADDCARRY_U64)
endif()
-check_c_source_runs("
- int main(void) {
- char buf[16] = { 0, 1, 2 };
- int *p = (int *)(buf + 1);
- int *q = (int *)(buf + 2);
- return (*p == *q);
- }
- " RELAXED_ALIGNMENT)
if (NOT RELAXED_ALIGNMENT)
add_definitions(-DSTRICT_ALIGNMENT)
endif()

View File

@ -0,0 +1,56 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -357,9 +357,11 @@ set_target_properties(lib_gost_engine PR
COMPILE_DEFINITIONS "BUILDING_ENGINE_AS_LIBRARY"
PUBLIC_HEADER gost-engine.h
OUTPUT_NAME "gost")
-target_link_libraries(lib_gost_engine PRIVATE gost_core gost_err)
+#target_link_libraries(lib_gost_engine PRIVATE gost_core gost_err)
+target_link_libraries(lib_gost_engine PRIVATE gost_core)
endif()
+if (0)
# The GOST provider uses this
add_subdirectory(libprov)
@@ -384,6 +386,7 @@ set_target_properties(lib_gost_prov PROP
)
target_link_libraries(lib_gost_prov PRIVATE gost_core libprov)
endif()
+endif()
set(GOST_SUM_SOURCE_FILES
gostsum.c
@@ -424,15 +427,15 @@ install(FILES gostsum.1 gost12sum.1 DEST
install(TARGETS gost_engine EXPORT GostEngineConfig
LIBRARY DESTINATION ${OPENSSL_ENGINES_DIR}
RUNTIME DESTINATION ${OPENSSL_ENGINES_DIR})
-install(TARGETS gost_prov EXPORT GostProviderConfig
- LIBRARY DESTINATION ${OPENSSL_MODULES_DIR}
- RUNTIME DESTINATION ${OPENSSL_MODULES_DIR})
+#install(TARGETS gost_prov EXPORT GostProviderConfig
+# LIBRARY DESTINATION ${OPENSSL_MODULES_DIR}
+# RUNTIME DESTINATION ${OPENSSL_MODULES_DIR})
if (NOT MSVC)
# install engine and provider in library form
install(TARGETS lib_gost_engine EXPORT GostEngineConfig
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(TARGETS lib_gost_prov EXPORT GostProviderConfig
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+#install(TARGETS lib_gost_prov EXPORT GostProviderConfig
+# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if (MSVC)
@@ -440,8 +443,8 @@ if (MSVC)
EXPORT GostEngineConfig DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL)
install(FILES $<TARGET_PDB_FILE:gost_engine>
EXPORT GostEngineConfig DESTINATION ${OPENSSL_ENGINES_DIR} OPTIONAL)
- install(FILES $<TARGET_PDB_FILE:gost_prov>
- EXPORT GostProviderConfig DESTINATION ${OPENSSL_MODULES_DIR} OPTIONAL)
+# install(FILES $<TARGET_PDB_FILE:gost_prov>
+# EXPORT GostProviderConfig DESTINATION ${OPENSSL_MODULES_DIR} OPTIONAL)
endif()
install(EXPORT GostEngineConfig DESTINATION GostEngine/share/cmake/GostEngine)
-install(EXPORT GostProviderConfig DESTINATION GostEngine/share/cmake/GostProvider)
+#install(EXPORT GostProviderConfig DESTINATION GostEngine/share/cmake/GostProvider)