55 lines
2.5 KiB
Diff
55 lines
2.5 KiB
Diff
diff -rupN --no-dereference openssl-3.0.3/Configurations/10-main.conf openssl-3.0.3-new/Configurations/10-main.conf
|
|
--- openssl-3.0.3/Configurations/10-main.conf 2022-06-02 14:30:31.872053349 +0200
|
|
+++ openssl-3.0.3-new/Configurations/10-main.conf 2022-06-02 14:30:34.045053398 +0200
|
|
@@ -1479,7 +1479,7 @@ my %targets = (
|
|
cppflags => combine("-DUNICODE -D_UNICODE -DWIN32_LEAN_AND_MEAN",
|
|
threads("-D_MT")),
|
|
lib_cppflags => "-DL_ENDIAN",
|
|
- ex_libs => add("-lws2_32 -lgdi32 -lcrypt32"),
|
|
+ ex_libs => add("-lws2_32 -lgdi32 -lcrypt32 -lpathcch"),
|
|
thread_scheme => "winthreads",
|
|
dso_scheme => "win32",
|
|
shared_target => "mingw-shared",
|
|
diff -rupN --no-dereference openssl-3.0.3/crypto/provider_core.c openssl-3.0.3-new/crypto/provider_core.c
|
|
--- openssl-3.0.3/crypto/provider_core.c 2022-05-03 15:32:01.000000000 +0200
|
|
+++ openssl-3.0.3-new/crypto/provider_core.c 2022-06-02 14:30:34.045053398 +0200
|
|
@@ -27,6 +27,10 @@
|
|
#ifndef FIPS_MODULE
|
|
# include <openssl/self_test.h>
|
|
#endif
|
|
+#ifdef _WIN32
|
|
+# include <windows.h>
|
|
+# include <pathcch.h>
|
|
+#endif
|
|
|
|
/*
|
|
* This file defines and uses a number of different structures:
|
|
@@ -872,6 +876,27 @@ static int provider_init(OSSL_PROVIDER *
|
|
|
|
if (load_dir == NULL) {
|
|
load_dir = ossl_safe_getenv("OPENSSL_MODULES");
|
|
+#ifdef _WIN32
|
|
+ if (load_dir == NULL) {
|
|
+ WCHAR execPath[MAX_PATH] = {0};
|
|
+ if( GetModuleFileNameW(NULL, execPath, _countof(execPath)) > 0)
|
|
+ {
|
|
+ PathCchRemoveFileSpec(execPath, MAX_PATH);
|
|
+ PathCchRemoveFileSpec(execPath, MAX_PATH);
|
|
+ wcsncat(execPath, L"\\lib\\ossl-modules", MAX_PATH);
|
|
+ int len = WideCharToMultiByte(CP_UTF8, 0, execPath, -1, NULL, 0, NULL, NULL);
|
|
+ if (len > 0)
|
|
+ {
|
|
+ allocated_load_dir = OPENSSL_malloc(len);
|
|
+ if (WideCharToMultiByte(CP_UTF8, 0, execPath, -1, allocated_load_dir, len, NULL, NULL) == len)
|
|
+ {
|
|
+ load_dir = allocated_load_dir;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+#endif
|
|
+
|
|
if (load_dir == NULL)
|
|
load_dir = MODULESDIR;
|
|
}
|