From: Neil Horman Date: Fri, 7 Jun 2024 17:36:46 +0000 (-0400) Subject: Change WININSTALLCONTEXT to OSSL_WINCTX X-Git-Tag: openssl-3.4.0-alpha1~397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=630e3a168446ab7e269176bad5b1bf79ea54301a;p=thirdparty%2Fopenssl.git Change WININSTALLCONTEXT to OSSL_WINCTX Make it more in line with other command line defines, and a bit shorter Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/24450) --- diff --git a/NOTES-WINDOWS.md b/NOTES-WINDOWS.md index e218f28bee7..f19bcab4f64 100644 --- a/NOTES-WINDOWS.md +++ b/NOTES-WINDOWS.md @@ -130,19 +130,22 @@ defaults can be overridden by registry keys. This is done because it is common practice for windows based installers to allow users to place the installation tree at various locations not defined at build time. The following keys: - `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL\OPENSSLDIR` - `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL\ENGINESDIR` - `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL\MODULESDIR` + `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\OPENSSLDIR` + `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\ENGINESDIR` + `\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL--\MODULESDIR` Can be administratively set, and openssl will take the paths found there as the -values for OPENSSLDIR, ENGINESDIR and MODULESDIR respectively. If unset, the -build time defaults will be used. +values for OPENSSLDIR, ENGINESDIR and MODULESDIR respectively. To enable the reading of registry keys from windows builds, add -`-DWININSTALLCONTEXT=`to the Configure command line. Without setting -this, the library defaults back to reporing the build time defaults without -checking the registry. Note that if you wish to have a private set of registry -keys for your application, you should set `OPENSSL_VERSION` to a unique value +`-DOPENSSL_WINCTX=`to the Configure command line. This define is used +at build time to construct library build specific registry key paths of the +format: +`\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432node\OpenSSL--` +Where `` is the semantic major.minor.patch version of the library being +built, and `` is the value specified by `-DOPENSSL_WINCTX`. This allows +for multiple openssl builds to be created and installed on a single system, in +which each library can use its own set of registry keys. Note the installer available at will set these keys when the installer is run. diff --git a/apps/version.c b/apps/version.c index 50ae1388be0..278afe8bf93 100644 --- a/apps/version.c +++ b/apps/version.c @@ -136,7 +136,7 @@ opthelp: if (cpuinfo) printf("%s\n", OpenSSL_version(OPENSSL_CPU_INFO)); if (windows) - printf("WININSTALLCONTEXT: %s\n", OpenSSL_version(OPENSSL_WININSTALLCONTEXT)); + printf("OSSL_WINCTX: %s\n", OpenSSL_version(OPENSSL_WINCTX)); ret = 0; end: return ret; diff --git a/crypto/cversion.c b/crypto/cversion.c index d3f193a9efb..219479f19a3 100644 --- a/crypto/cversion.c +++ b/crypto/cversion.c @@ -70,7 +70,7 @@ const char *OpenSSL_version(int t) return ossl_cpu_info_str; else return "CPUINFO: N/A"; - case OPENSSL_WININSTALLCONTEXT: + case OPENSSL_WINCTX: return ossl_get_wininstallcontext(); } return "not available"; diff --git a/crypto/defaults.c b/crypto/defaults.c index e882d35c1f3..56f2cb417a2 100644 --- a/crypto/defaults.c +++ b/crypto/defaults.c @@ -18,8 +18,8 @@ # define TOSTR(x) #x # define MAKESTR(x) TOSTR(x) # define NOQUOTE(x) x -#if defined(WININSTALLCONTEXT) -# define REGISTRY_KEY "SOFTWARE\\WOW6432Node\\OpenSSL" ##"-"## NOQUOTE(OPENSSL_VERSION_STR) ##"-"## MAKESTR(WININSTALLCONTEXT) +#if defined(OSSL_WINCTX) +# define REGISTRY_KEY "SOFTWARE\\WOW6432Node\\OpenSSL" ##"-"## NOQUOTE(OPENSSL_VERSION_STR) ##"-"## MAKESTR(OSSL_WINCTX) #else # define REGISTRY_KEY "NONE" #endif @@ -117,7 +117,7 @@ DEFINE_RUN_ONCE_STATIC(do_defaults_setup) const char *ossl_get_openssldir(void) { #if defined(_WIN32) -# if defined(WININSTALLCONTEXT) +# if defined(OSSL_WINCTX) if (!RUN_ONCE(&defaults_setup_init, do_defaults_setup)) return NULL; return (const char *)openssldir; @@ -141,7 +141,7 @@ const char *ossl_get_openssldir(void) const char *ossl_get_enginesdir(void) { #if defined(_WIN32) -# if defined(WININSTALLCONTEXT) +# if defined(OSSL_WINCTX) if (!RUN_ONCE(&defaults_setup_init, do_defaults_setup)) return NULL; return (const char *)enginesdir; @@ -165,7 +165,7 @@ const char *ossl_get_enginesdir(void) const char *ossl_get_modulesdir(void) { #if defined(_WIN32) -# if definied (WININSTALLCONTEXT) +# if defined (OSSL_WINCTX) if (!RUN_ONCE(&defaults_setup_init, do_defaults_setup)) return NULL; return (const char *)modulesdir; @@ -188,8 +188,8 @@ const char *ossl_get_modulesdir(void) */ const char *ossl_get_wininstallcontext(void) { -#if defined(_WIN32) && defined (WININSTALLCONTEXT) - return MAKESTR(WININSTALLCONTEXT); +#if defined(_WIN32) && defined (OSSL_WINCTX) + return MAKESTR(OSSL_WINCTX); #else return ""; #endif diff --git a/include/openssl/crypto.h.in b/include/openssl/crypto.h.in index ee92bf61d22..99041cce065 100644 --- a/include/openssl/crypto.h.in +++ b/include/openssl/crypto.h.in @@ -170,7 +170,7 @@ const char *OpenSSL_version(int type); # define OPENSSL_FULL_VERSION_STRING 7 # define OPENSSL_MODULES_DIR 8 # define OPENSSL_CPU_INFO 9 -# define OPENSSL_WININSTALLCONTEXT 10 +# define OPENSSL_WINCTX 10 const char *OPENSSL_info(int type); /*