Skip to content

Commit

Permalink
Add 'openssl info' item for the Windows install context
Browse files Browse the repository at this point in the history
This information is already present as an 'openssl version' item.

Reviewed-by: Matt Caswell <[email protected]>
Reviewed-by: Tomas Mraz <[email protected]>
(Merged from openssl#25694)
  • Loading branch information
levitte authored and t8m committed Oct 16, 2024
1 parent 50e9d2b commit 5f3fefe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
typedef enum OPTION_choice {
OPT_COMMON,
OPT_CONFIGDIR, OPT_ENGINESDIR, OPT_MODULESDIR, OPT_DSOEXT, OPT_DIRNAMESEP,
OPT_LISTSEP, OPT_SEEDS, OPT_CPUSETTINGS
OPT_LISTSEP, OPT_SEEDS, OPT_CPUSETTINGS, OPT_WINDOWSCONTEXT
} OPTION_CHOICE;

const OPTIONS info_options[] = {
Expand All @@ -32,6 +32,7 @@ const OPTIONS info_options[] = {
{"listsep", OPT_LISTSEP, '-', "List separator character"},
{"seeds", OPT_SEEDS, '-', "Seed sources"},
{"cpusettings", OPT_CPUSETTINGS, '-', "CPU settings info"},
{"windowscontext", OPT_WINDOWSCONTEXT, '-', "Windows install context"},
{NULL}
};

Expand Down Expand Up @@ -85,6 +86,10 @@ int info_main(int argc, char **argv)
type = OPENSSL_INFO_CPU_SETTINGS;
dirty++;
break;
case OPT_WINDOWSCONTEXT:
type = OPENSSL_INFO_WINDOWS_CONTEXT;
dirty++;
break;
}
}
if (!opt_check_rest_arg(NULL))
Expand Down
2 changes: 2 additions & 0 deletions crypto/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ const char *OPENSSL_info(int t)
if (ossl_cpu_info_str[0] != '\0')
return ossl_cpu_info_str + strlen(CPUINFO_PREFIX);
break;
case OPENSSL_INFO_WINDOWS_CONTEXT:
return ossl_get_wininstallcontext();
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions doc/man1/openssl-info.pod.in
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Outputs the randomness seed sources.

Outputs the OpenSSL CPU settings info.

=item B<-windowscontext>

Outputs the Windows install context.

=back

=head1 HISTORY
Expand Down
9 changes: 9 additions & 0 deletions doc/man3/OpenSSL_version.pod
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@ automatically configured but may be set via an environment variable.
The value has the same syntax as the environment variable.
For x86 the string looks like C<OPENSSL_ia32cap=0x123:0x456>.

=item OPENSSL_INFO_WINDOWS_CONTEXT

The Windows install context.
The Windows install context is used to compute the OpenSSL registry key name
on Windows. The full registry key is
C<SOFTWARE\WOW6432Node\OpenSSL-{major}.{minor}-{context}>, where C<{major}>,
C<{minor}> and C<{context}> are OpenSSL's major version number, minor version
number and the Windows install context, respectively.

=back

For an unknown I<t>, NULL is returned.
Expand Down
1 change: 1 addition & 0 deletions include/openssl/crypto.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ const char *OPENSSL_info(int type);
# define OPENSSL_INFO_LIST_SEPARATOR 1006
# define OPENSSL_INFO_SEED_SOURCE 1007
# define OPENSSL_INFO_CPU_SETTINGS 1008
# define OPENSSL_INFO_WINDOWS_CONTEXT 1009

int OPENSSL_issetugid(void);

Expand Down

0 comments on commit 5f3fefe

Please sign in to comment.