[openssl] master update

Dr. Paul Dale pauli at openssl.org
Thu May 13 04:22:39 UTC 2021


The branch master has been updated
       via  9a633a1c97e387157560641c4f7043efe52dba6b (commit)
      from  7f24110a005496617110495e826d283900a028b7 (commit)


- Log -----------------------------------------------------------------
commit 9a633a1c97e387157560641c4f7043efe52dba6b
Author: Pauli <pauli at openssl.org>
Date:   Thu May 13 10:34:42 2021 +1000

    test: fix thread test config file problem
    
    Force the thread test to use the configuration file via a command line arg.
    Use the test library support for libctx creation.
    
    Fixes #15243
    
    Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/15256)

-----------------------------------------------------------------------

Summary of changes:
 test/recipes/90-test_threads.t | 10 ++++++----
 test/threadstest.c             | 15 +++++++++++----
 2 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/test/recipes/90-test_threads.t b/test/recipes/90-test_threads.t
index 53883ee629..a841a4b2f5 100644
--- a/test/recipes/90-test_threads.t
+++ b/test/recipes/90-test_threads.t
@@ -20,13 +20,15 @@ use lib srctop_dir('Configurations');
 use lib bldtop_dir('.');
 
 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
+my $config_path = abs_path(srctop_file("test", $no_fips ? "default.cnf"
+                                                        : "default-and-fips.cnf"));
 
 plan tests => 1;
 
 if ($no_fips) {
-    $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default.cnf"));
-    ok(run(test(["threadstest", data_dir()])), "running test_threads");
+    ok(run(test(["threadstest", "-config", $config_path, data_dir()])),
+       "running test_threads");
 } else {
-    $ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default-and-fips.cnf"));
-    ok(run(test(["threadstest", "-fips", data_dir()])), "running test_threads");
+    ok(run(test(["threadstest", "-fips", "-config", $config_path, data_dir()])),
+       "running test_threads with FIPS");
 }
diff --git a/test/threadstest.c b/test/threadstest.c
index 9d15a23d96..359b330024 100644
--- a/test/threadstest.c
+++ b/test/threadstest.c
@@ -23,6 +23,7 @@
 
 static int do_fips = 0;
 static char *privkey;
+static char *config_file = NULL;
 
 #if !defined(OPENSSL_THREADS) || defined(CRYPTO_TDEBUG)
 
@@ -450,9 +451,10 @@ static int test_multi(int idx)
 #endif
 
     multi_success = 1;
-    multi_libctx = OSSL_LIB_CTX_new();
-    if (!TEST_ptr(multi_libctx))
-        goto err;
+    if (!TEST_true(test_get_libctx(&multi_libctx, NULL, config_file,
+                                   NULL, NULL)))
+        return 0;
+
     prov = OSSL_PROVIDER_load(multi_libctx, (idx == 1) ? "fips" : "default");
     if (!TEST_ptr(prov))
         goto err;
@@ -583,7 +585,7 @@ static int test_multi_default(void)
 typedef enum OPTION_choice {
     OPT_ERR = -1,
     OPT_EOF = 0,
-    OPT_FIPS,
+    OPT_FIPS, OPT_CONFIG_FILE,
     OPT_TEST_ENUM
 } OPTION_CHOICE;
 
@@ -592,6 +594,8 @@ const OPTIONS *test_get_options(void)
     static const OPTIONS options[] = {
         OPT_TEST_OPTIONS_DEFAULT_USAGE,
         { "fips", OPT_FIPS, '-', "Test the FIPS provider" },
+        { "config", OPT_CONFIG_FILE, '<',
+          "The configuration file to use for the libctx" },
         { NULL }
     };
     return options;
@@ -607,6 +611,9 @@ int setup_tests(void)
         case OPT_FIPS:
             do_fips = 1;
             break;
+        case OPT_CONFIG_FILE:
+            config_file = opt_arg();
+            break;
         case OPT_TEST_CASES:
             break;
         default:


More information about the openssl-commits mailing list