#! /usr/bin/env perl
-# Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
use lib srctop_dir('Configurations');
use lib bldtop_dir('.');
-use platform;
my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
$no_rc2 = 1 if disabled("legacy");
plan tests =>
- ($no_fips ? 0 : 1) # FIPS install test
+ 10;
unless ($no_fips) {
- my $infile = bldtop_file('providers', platform->dso('fips'));
-
- ok(run(app(['openssl', 'fipsinstall',
- '-out', bldtop_file('providers', 'fipsmodule.cnf'),
- '-module', $infile])),
- "fipsinstall");
@config = ( "-config", srctop_file("test", "fips-and-base.cnf") );
$provname = 'fips';
}
);
my @smime_cms_cades_ko_tests = (
- [ "signed content DER format, RSA key, but verified as CAdES-BES compatible",
+ [ "sign content DER format, RSA key, not CAdES-BES compatible",
[ @prov, "-sign", "-in", $smcont, "-outform", "DER", "-nodetach",
"-certfile", catfile($smdir, "smroot.pem"),
"-signer", catfile($smdir, "smrsa1.pem"), "-out", "{output}.cms" ],
+ "fail to verify token because requiring CAdES-BES compatibility",
[ @prov, "-verify", "-cades", "-in", "{output}.cms", "-inform", "DER",
"-CAfile", catfile($smdir, "smroot.pem"), "-out", "{output}.txt" ],
\&final_compare
[ "{cmd1}", @prov, "-encrypt", "-in", $smcont,
"-stream", "-out", "{output}.cms",
"-recip", catfile($smdir, "smdh.pem"), "-aes128" ],
- [ "{cmd2}", "-decrypt", "-recip", catfile($smdir, "smdh.pem"),
+ [ "{cmd2}", @prov, "-decrypt", "-recip", catfile($smdir, "smdh.pem"),
"-in", "{output}.cms", "-out", "{output}.txt" ],
\&final_compare
]
};
subtest "CAdES ko tests\n" => sub {
- plan tests => (scalar @smime_cms_cades_ko_tests);
+ plan tests => 2 * scalar @smime_cms_cades_ko_tests;
foreach (@smime_cms_cades_ko_tests) {
SKIP: {
my $skip_reason = check_availability($$_[0]);
skip $skip_reason, 1 if $skip_reason;
- ok(run(app(["openssl", "cms", @{$$_[1]}]))
- && !run(app(["openssl", "cms", @{$$_[2]}])),
- $$_[0]);
+ ok(run(app(["openssl", "cms", @{$$_[1]}])), $$_[0]);
+ ok(!run(app(["openssl", "cms", @{$$_[3]}])), $$_[2]);
}
}
};