Change WININSTALLCONTEXT to OSSL_WINCTX

Make it more in line with other command line defines, and a bit shorter

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24450)
This commit is contained in:
Neil Horman 2024-06-07 13:36:46 -04:00
parent f4540c1b14
commit 630e3a1684
5 changed files with 22 additions and 19 deletions

View File

@ -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-<version>-<ctx>\OPENSSLDIR`
`\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL-<version>-<ctx>\ENGINESDIR`
`\\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\OpenSSL-<version>-<ctx>\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=<string>`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=<string>`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-<version>-<ctx>`
Where `<version>` is the semantic major.minor.patch version of the library being
built, and `<ctx>` 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 <https://github.com/openssl/installer> will set
these keys when the installer is run.

View File

@ -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;

View File

@ -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";

View File

@ -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

View File

@ -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);
/*