--- a/crypto/build.info +++ b/crypto/build.info @@ -107,7 +107,7 @@ 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 sleep.c deterministic_nonce.c quic_vlint.c \ - time.c + time.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 @@ -454,8 +455,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 #include "internal/cryptlib.h" +#include "pathtools.h" #include #include 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 #endif @@ -916,8 +917,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,