diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-04-09 12:47:46 +1000 |
---|---|---|
committer | Shane Lontis <shane.lontis@oracle.com> | 2020-04-09 12:47:46 +1000 |
commit | f5056577ba08b3694aab2722eae1c97bf00acc80 (patch) | |
tree | 00492b31c1e6b69164d5a3be50557bac18cdcd2e /test | |
parent | cc45a884bd499e8b84de0c0133746591c3712f4c (diff) |
Move legacy ciphers into the legacy provider
DES, idea, seed, rc2, rc4, rc5, cast and blowfish have been moved out of the default provider.
Code shared between desx and tdes has been moved into a seperate file (cipher_tdes_common.c).
3 test recipes failed due to using app/openssl calls that used legacy ciphers.
These calls have been updated to supply both the default and legacy providers.
Fixed openssl app '-provider' memory leak
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/11419)
Diffstat (limited to 'test')
-rw-r--r-- | test/recipes/20-test_enc.t | 8 | ||||
-rw-r--r-- | test/recipes/20-test_enc_more.t | 8 | ||||
-rw-r--r-- | test/recipes/80-test_cms.t | 15 |
3 files changed, 20 insertions, 11 deletions
diff --git a/test/recipes/20-test_enc.t b/test/recipes/20-test_enc.t index b4a8e01878..896de8cde3 100644 --- a/test/recipes/20-test_enc.t +++ b/test/recipes/20-test_enc.t @@ -14,7 +14,7 @@ use File::Spec::Functions qw/catfile/; use File::Copy; use File::Compare qw/compare_text/; use File::Basename; -use OpenSSL::Test qw/:DEFAULT srctop_file/; +use OpenSSL::Test qw/:DEFAULT srctop_file bldtop_dir/; setup("test_enc"); @@ -26,6 +26,8 @@ my $testsrc = srctop_file("test","recipes",basename($0)); my $test = catfile(".", "p"); my $cmd = "openssl"; +my $provpath = bldtop_dir("providers"); +my @prov = ("-provider_path", $provpath, "-provider", "default", "-provider", "legacy"); my $ciphersstatus = undef; my @ciphers = @@ -59,8 +61,8 @@ plan tests => 2 + (scalar @ciphers)*2; @d = ( "enc", @{$variant{$t}}, "-d" ); } - ok(run(app([$cmd, @e, "-in", $test, "-out", $cipherfile])) - && run(app([$cmd, @d, "-in", $cipherfile, "-out", $clearfile])) + ok(run(app([$cmd, @e, @prov, "-in", $test, "-out", $cipherfile])) + && run(app([$cmd, @d, @prov, "-in", $cipherfile, "-out", $clearfile])) && compare_text($test,$clearfile) == 0, $t); } } diff --git a/test/recipes/20-test_enc_more.t b/test/recipes/20-test_enc_more.t index a59663412a..7edcff01c8 100644 --- a/test/recipes/20-test_enc_more.t +++ b/test/recipes/20-test_enc_more.t @@ -15,7 +15,7 @@ use File::Spec::Functions qw/catfile/; use File::Copy; use File::Compare qw/compare_text/; use File::Basename; -use OpenSSL::Test qw/:DEFAULT srctop_file/; +use OpenSSL::Test qw/:DEFAULT srctop_file bldtop_dir/; setup("test_evp_more"); @@ -25,6 +25,8 @@ my $cipherlist = undef; my $plaintext = catfile(".", "testdatafile"); my $fail = ""; my $cmd = "openssl"; +my $provpath = bldtop_dir("providers"); +my @prov = ("-provider_path", $provpath, "-provider", "default", "-provider", "legacy"); my $ciphersstatus = undef; my @ciphers = @@ -49,9 +51,9 @@ SKIP: { my $clearfile = "$plaintext.$ciphername.clear"; my @common = ( $cmd, "enc", "$cipher", "-k", "test" ); - ok(run(app([@common, "-e", "-in", $plaintext, "-out", $cipherfile])) + ok(run(app([@common, @prov, "-e", "-in", $plaintext, "-out", $cipherfile])) && compare_text($plaintext, $cipherfile) != 0 - && run(app([@common, "-d", "-in", $cipherfile, "-out", $clearfile])) + && run(app([@common, @prov, "-d", "-in", $cipherfile, "-out", $clearfile])) && compare_text($plaintext, $clearfile) == 0 , $ciphername); } diff --git a/test/recipes/80-test_cms.t b/test/recipes/80-test_cms.t index fd66557616..0e2969dee0 100644 --- a/test/recipes/80-test_cms.t +++ b/test/recipes/80-test_cms.t @@ -13,7 +13,7 @@ use warnings; use POSIX; use File::Spec::Functions qw/catfile/; use File::Compare qw/compare_text/; -use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file/; +use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir/; use OpenSSL::Test::Utils; setup("test_cms"); @@ -21,6 +21,9 @@ setup("test_cms"); plan skip_all => "CMS is not supported by this OpenSSL build" if disabled("cms"); +my $provpath = bldtop_dir("providers"); +my @prov = ("-provider_path", $provpath, "-provider", "default", "-provider", "legacy"); + my $datadir = srctop_dir("test", "recipes", "80-test_cms_data"); my $smdir = srctop_dir("test", "smime-certs"); my $smcont = srctop_file("test", "smcont.txt"); @@ -311,10 +314,11 @@ my @smime_cms_tests = ( ], [ "encrypted content test streaming PEM format, 128 bit RC2 key", - [ "{cmd1}", "-EncryptedData_encrypt", "-in", $smcont, "-outform", "PEM", + [ "{cmd1}", @prov, "-EncryptedData_encrypt", + "-in", $smcont, "-outform", "PEM", "-rc2", "-secretkey", "000102030405060708090A0B0C0D0E0F", "-stream", "-out", "{output}.cms" ], - [ "{cmd2}", "-EncryptedData_decrypt", "-in", "{output}.cms", + [ "{cmd2}", @prov, "-EncryptedData_decrypt", "-in", "{output}.cms", "-inform", "PEM", "-secretkey", "000102030405060708090A0B0C0D0E0F", "-out", "{output}.txt" ], @@ -322,10 +326,11 @@ my @smime_cms_tests = ( ], [ "encrypted content test streaming PEM format, 40 bit RC2 key", - [ "{cmd1}", "-EncryptedData_encrypt", "-in", $smcont, "-outform", "PEM", + [ "{cmd1}", @prov, "-EncryptedData_encrypt", + "-in", $smcont, "-outform", "PEM", "-rc2", "-secretkey", "0001020304", "-stream", "-out", "{output}.cms" ], - [ "{cmd2}", "-EncryptedData_decrypt", "-in", "{output}.cms", + [ "{cmd2}", @prov, "-EncryptedData_decrypt", "-in", "{output}.cms", "-inform", "PEM", "-secretkey", "0001020304", "-out", "{output}.txt" ], \&final_compare |