Files
MINGW-packages/mingw-w64-openssl/002-relocation.patch
مهدي شينون (Mehdi Chinoune) 6fc2a827f3 openssl: update to 3.1.0
2023-03-15 08:10:11 +01:00

115 lines
3.3 KiB
Diff

--- a/crypto/build.info
+++ b/crypto/build.info
@@ -107,7 +107,7 @@
mem.c mem_sec.c \
cversion.c info.c cpt_err.c ebcdic.c uid.c o_time.c o_dir.c \
o_fopen.c getenv.c o_init.c init.c trace.c provider.c provider_child.c \
- punycode.c passphrase.c
+ punycode.c passphrase.c pathtools.c
SOURCE[../providers/libfips.a]=$UTIL_COMMON
SOURCE[../libcrypto]=$UPLINKSRC
--- a/crypto/engine/eng_list.c
+++ b/crypto/engine/eng_list.c
@@ -12,6 +12,7 @@
#define OPENSSL_SUPPRESS_DEPRECATED
#include "eng_local.h"
+#include "pathtools.h"
/*
* The linked-list of pointers to engine types. engine_list_head incorporates
@@ -413,8 +414,13 @@
* Prevent infinite recursion if we're looking for the dynamic engine.
*/
if (strcmp(id, "dynamic")) {
- if ((load_dir = ossl_safe_getenv("OPENSSL_ENGINES")) == NULL)
- load_dir = ENGINESDIR;
+ if ((load_dir = ossl_safe_getenv("OPENSSL_ENGINES")) == NULL) {
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, ENGINESDIR);
+ }
+ load_dir = reloc;
+ }
iterator = ENGINE_by_id("dynamic");
if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||
!ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||
--- a/crypto/x509/x509_def.c
+++ b/crypto/x509/x509_def.c
@@ -9,27 +9,44 @@
#include <stdio.h>
#include "internal/cryptlib.h"
+#include "pathtools.h"
#include <openssl/crypto.h>
#include <openssl/x509.h>
const char *X509_get_default_private_dir(void)
{
- return X509_PRIVATE_DIR;
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, X509_PRIVATE_DIR);
+ }
+ return reloc;
}
const char *X509_get_default_cert_area(void)
{
- return X509_CERT_AREA;
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, X509_CERT_AREA);
+ }
+ return reloc;
}
const char *X509_get_default_cert_dir(void)
{
- return X509_CERT_DIR;
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, X509_CERT_DIR);
+ }
+ return reloc;
}
const char *X509_get_default_cert_file(void)
{
- return X509_CERT_FILE;
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, X509_CERT_FILE);
+ }
+ return reloc;
}
const char *X509_get_default_cert_dir_env(void)
--- a/crypto/provider_core.c
+++ b/crypto/provider_core.c
@@ -30,6 +30,7 @@
#include "internal/core.h"
#include "provider_local.h"
#include "crypto/context.h"
+#include "pathtools.h"
#ifndef FIPS_MODULE
# include <openssl/self_test.h>
#endif
@@ -874,8 +875,13 @@
if (load_dir == NULL) {
load_dir = ossl_safe_getenv("OPENSSL_MODULES");
- if (load_dir == NULL)
- load_dir = MODULESDIR;
+ if (load_dir == NULL) {
+ static char * reloc = NULL;
+ if (reloc == NULL) {
+ reloc = single_path_relocation_lib(OPENSSLBIN, MODULESDIR);
+ }
+ load_dir = reloc;
+ }
}
DSO_ctrl(prov->module, DSO_CTRL_SET_FLAGS,