Fix Windows build and provider loading issues #510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix Windows build issues: OSSL_provider_init export and C4702 unreachable code
This PR fixes two issues encountered when building and running
gost-engineon Windows using MSVC.1. Fix missing export for OSSL_provider_init
Problem
When attempting to load the provider on Windows, OpenSSL fails with the following error:
Cause
On Windows, the entry point function
OSSL_provider_initmust be explicitly exported from the DLL. WhileOPENSSL_EXPORTis used, in some build configurations with MSVC and macro aliasing, the symbol might not be correctly added to the export table.Solution
Added
#pragma comment(linker, "/EXPORT:OSSL_provider_init")for Windows builds to ensure the symbol is visible to OpenSSL's DSO loader regardless of the build environment specifics.2. Fix MSVC Warning/Error C4702 (Unreachable Code)
Problem
Build fails in Release configuration with the following error:
Cause
In
gost12sum.c, thehelp()function internally callsexit(). Therefore, theexit(0)following thehelp()call in theswitchstatement is unreachable. This triggers a compiler error when "Warnings as Errors" is enabled.Solution
Removed the redundant
exit(0)call afterhelp().Environment