diff options
author | Pauli <pauli@openssl.org> | 2021-05-14 07:41:14 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-24 01:39:15 +0200 |
commit | 235776b2c70fa2e283ea9fb47daf2cab4bc2309a (patch) | |
tree | 5c1e360a72797a4e3843d69b9f581192255b714f /test/recipes/90-test_threads.t | |
parent | 80-test_cmp_http: Invert and correct the logic of success vs. failure exit (diff) | |
download | openssl-235776b2c70fa2e283ea9fb47daf2cab4bc2309a.tar.xz openssl-235776b2c70fa2e283ea9fb47daf2cab4bc2309a.zip |
test: add test case to reliably reproduce RAND leak during POST
The FIPS provider leaks a RAND if the POST is run at initialisation time.
This test case reliably reproduces this event.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15278)
Diffstat (limited to 'test/recipes/90-test_threads.t')
-rw-r--r-- | test/recipes/90-test_threads.t | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/recipes/90-test_threads.t b/test/recipes/90-test_threads.t index a841a4b2f5..651fa805d5 100644 --- a/test/recipes/90-test_threads.t +++ b/test/recipes/90-test_threads.t @@ -23,7 +23,7 @@ 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; +plan tests => 2; if ($no_fips) { ok(run(test(["threadstest", "-config", $config_path, data_dir()])), @@ -32,3 +32,25 @@ if ($no_fips) { ok(run(test(["threadstest", "-fips", "-config", $config_path, data_dir()])), "running test_threads with FIPS"); } + +# Merge the configuration files into one filtering the contents so the failure +# condition is reproducable. A working FIPS configuration without the install +# status is required. + +open CFGBASE, '<', $config_path; +open CFGINC, '<', bldtop_file('/providers/fipsmodule.cnf'); +open CFGOUT, '>', 'thread.cnf'; + +while (<CFGBASE>) { + print CFGOUT unless m/^[.]include/; +} +close CFGBASE; +print CFGOUT "\n\n"; +while (<CFGINC>) { + print CFGOUT unless m/^install-status/; +} +close CFGINC; +close CFGOUT; + +$ENV{OPENSSL_CONF} = 'thread.cnf'; +ok(run(test(["threadstest_fips"])), "running test_threads_fips"); |