summaryrefslogtreecommitdiffstats
path: root/apps/openssl.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-07-23 17:40:40 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-07-23 17:40:40 +1000
commitae89578be2930c726d6ef56451233757a89f224f (patch)
treedfe6f7fb5bc4b550b67bea0fe219fd6a132bd944 /apps/openssl.c
parenta27cb956c02220c502449176a8834b1d9643ac23 (diff)
Test RSA oaep in fips mode
Added RSA oaep test that uses the pkeyutl application. Added an openssl application option to support loading a (fips) provider via the '-config' option. Added openssl application related environment variable 'OPENSSL_TEST_LIBCTX' (for testing purposes only), that creates a non default library context. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11948)
Diffstat (limited to 'apps/openssl.c')
-rw-r--r--apps/openssl.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/openssl.c b/apps/openssl.c
index a1b4443e4b..6b2c2b9c6b 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -58,6 +58,7 @@ static void warn_deprecated(const FUNCTION *fp)
static int apps_startup(void)
{
+ const char *use_libctx = NULL;
#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
#endif
@@ -69,11 +70,26 @@ static int apps_startup(void)
setup_ui_method();
+ /*
+ * NOTE: This is an undocumented feature required for testing only.
+ * There are no guarantees that it will exist in future builds.
+ */
+ use_libctx = getenv("OPENSSL_TEST_LIBCTX");
+ if (use_libctx != NULL) {
+ /* Set this to "1" to create a global libctx */
+ if (strcmp(use_libctx, "1") == 0) {
+ if (app_create_libctx() == NULL)
+ return 0;
+ }
+ }
+
return 1;
}
static void apps_shutdown(void)
{
+ app_providers_cleanup();
+ OPENSSL_CTX_free(app_get0_libctx());
destroy_ui_method();
}
@@ -273,7 +289,6 @@ int main(int argc, char *argv[])
: do_cmd(prog, 1, help_argv);
end:
- app_providers_cleanup();
OPENSSL_free(default_config_file);
lh_FUNCTION_free(prog);
OPENSSL_free(arg.argv);