From 625faca931957719c76fb16094cf5b6e0debe23f Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 14 Dec 2022 17:15:18 +0000 Subject: Check CMS failure during BIO setup with -stream is handled correctly Test for the issue fixed in the previous commit Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz --- test/recipes/80-test_cms.t | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test/recipes/80-test_cms.t') diff --git a/test/recipes/80-test_cms.t b/test/recipes/80-test_cms.t index 01947b4977..dba5b52b60 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 compare/; -use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir bldtop_file/; +use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir bldtop_file with/; use OpenSSL::Test::Utils; @@ -50,7 +50,7 @@ my ($no_des, $no_dh, $no_dsa, $no_ec, $no_ec2m, $no_rc2, $no_zlib) $no_rc2 = 1 if disabled("legacy"); -plan tests => 17; +plan tests => 18; ok(run(test(["pkcs7_test"])), "test pkcs7"); @@ -1110,3 +1110,14 @@ ok(!run(app(['openssl', 'cms', '-verify', "SignedInvalidMappingFromanyPolicyTest7.eml") ])), "issue#19643"); + +# Check that we get the expected failure return code +with({ exit_checker => sub { return shift == 6; } }, + sub { + ok(run(app(['openssl', 'cms', '-encrypt', + '-in', srctop_file("test", "smcont.txt"), + '-stream', '-recip', + srctop_file("test/smime-certs", "badrsa.pem"), + ])), + "Check failure during BIO setup with -stream is handled correctly"); + }); -- cgit v1.2.3