From 1e5f3f565a37533d13fdf62a8b5e00babdb76e71 Mon Sep 17 00:00:00 2001 From: youngwise Date: Tue, 27 Jan 2026 00:43:25 +0300 Subject: [PATCH 1/2] Fix Windows build and provider loading issues --- gost12sum.c | 1 - gost_prov.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/gost12sum.c b/gost12sum.c index 7e443d30d..8ad50e36c 100644 --- a/gost12sum.c +++ b/gost12sum.c @@ -88,7 +88,6 @@ int main(int argc, char **argv) switch (c) { case 'h': help(); - exit(0); break; case 'v': verbose = 1; diff --git a/gost_prov.c b/gost_prov.c index 4ae77a187..51ef23ea0 100644 --- a/gost_prov.c +++ b/gost_prov.c @@ -175,6 +175,10 @@ static const OSSL_DISPATCH provider_functions[] = { # define OSSL_provider_init GOST_provider_init #endif +#if defined(_WIN32) +#pragma comment(linker, "/EXPORT:OSSL_provider_init") +#endif + OPENSSL_EXPORT int OSSL_provider_init(const OSSL_CORE_HANDLE *core, const OSSL_DISPATCH *in, From 0ac84241bddd57a969dc40df36f3095bee5dbf52 Mon Sep 17 00:00:00 2001 From: youngwise Date: Thu, 29 Jan 2026 00:12:07 +0300 Subject: [PATCH 2/2] use target_link_options for MSVC export instead of pragma --- CMakeLists.txt | 3 +++ gost_prov.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 63d9efeb2..6d8324643 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -470,6 +470,9 @@ if(GOST_PROVIDER_ENABLE) PREFIX "" OUTPUT_NAME "gostprov" SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX} COMPILE_DEFINITIONS "BUILDING_GOST_PROVIDER;OPENSSL_NO_DYNAMIC_ENGINE" ) + if(MSVC) + target_link_options(gost_prov PRIVATE "/EXPORT:OSSL_provider_init") + endif() target_link_libraries(gost_prov PRIVATE gost_core libprov) if (NOT MSVC) diff --git a/gost_prov.c b/gost_prov.c index 51ef23ea0..4ae77a187 100644 --- a/gost_prov.c +++ b/gost_prov.c @@ -175,10 +175,6 @@ static const OSSL_DISPATCH provider_functions[] = { # define OSSL_provider_init GOST_provider_init #endif -#if defined(_WIN32) -#pragma comment(linker, "/EXPORT:OSSL_provider_init") -#endif - OPENSSL_EXPORT int OSSL_provider_init(const OSSL_CORE_HANDLE *core, const OSSL_DISPATCH *in,