use File::Spec::Functions qw/catfile/;
use File::Compare qw/compare_text/;
use OpenSSL::Test qw/:DEFAULT top_dir top_file/;
+use OpenSSL::Test::Utils;
setup("test_cms");
my $smdir = top_dir("test", "smime-certs");
my $smcont = top_file("test", "smcont.txt");
-my $no_ec = run(app(["openssl", "no-ec"], stdout => undef));
-my $no_ec2m = run(app(["openssl", "no-ec2m"], stdout => undef));
-my $no_ecdh = run(app(["openssl", "no-ecdh"], stdout => undef));
+my ($no_ec, $no_ec2m, $no_zlib) = disabled qw/ec ec2m zlib/;
plan tests => 4;
SKIP: {
skip("Zlib not supported: compression tests skipped",
scalar @smime_cms_comp_tests)
- unless grep /ZLIB/, run(app(["openssl", "version", "-f"]),
- capture => 1);
+ if $no_zlib;
foreach (@smime_cms_comp_tests) {
SKIP: {
return "$tnam: skipped, EC disabled\n"
if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, ECDH disabled\n"
- if ($no_ecdh && $tnam =~ /ECDH/);
+ if ($no_ec && $tnam =~ /ECDH/);
return "$tnam: skipped, EC2M disabled\n"
if ($no_ec2m && $tnam =~ /K-283/);
return "";
use File::Spec;
use File::Copy;
use OpenSSL::Test qw/:DEFAULT with top_file cmdstr/;
+use OpenSSL::Test::Utils;
setup("test_ssl");
+my ($no_rsa, $no_dsa, $no_dh, $no_ec, $no_srp, $no_psk) =
+ disabled qw/rsa dsa dh ec srp psk/;
+
my $digest = "-sha1";
my @reqcmd = ("openssl", "req");
my @x509cmd = ("openssl", "x509", $digest);
my @req_dsa = ("-newkey",
"dsa:".File::Spec->catfile("..", "apps", "dsa1024.pem"));;
my @req_new;
- if (run(app(["openssl", "no-rsa"], stdout => undef))) {
+ if ($no_rsa) {
@req_new = @req_dsa;
} else {
@req_new = ("-new");
skip 'failure', 7 unless
subtest 'DSA certificate creation' => sub {
plan skip_all => "skipping DSA certificate creation"
- if run(app(["openssl", "no-dsa"], stdout => undef));
+ if $no_dsa;
plan tests => 4;
skip 'failure', 6 unless
subtest 'ECDSA/ECDH certificate creation' => sub {
plan skip_all => "skipping ECDSA/ECDH certificate creation"
- if run(app(["openssl", "no-ec"], stdout => undef));
+ if $no_ec;
plan tests => 5;
my @exkeys = ();
my $ciphers = "-EXP:-PSK:-SRP:-kDH:-kECDHe";
- if (run(app(["openssl", "no-dhparam"], stdout => undef))) {
+ if ($no_dh) {
note "skipping DHE tests\n";
$ciphers .= ":-kDHE";
}
- if (run(app(["openssl", "no-dsa"], stdout => undef))) {
+ if ($no_dsa) {
note "skipping DSA tests\n";
$ciphers .= ":-aDSA";
} else {
push @exkeys, "-s_cert", "certD.ss", "-s_key", "keyD.ss";
}
- if (run(app(["openssl", "no-ec"], stdout => undef))) {
+ if ($no_ec) {
note "skipping EC tests\n";
$ciphers .= ":!aECDSA:!kECDH";
} else {
{
SKIP: {
skip "skipping anonymous DH tests", 1
- if (run(app(["openssl", "no-dhparam"], stdout => undef)));
+ if ($no_dh);
ok(run(test([@ssltest, "-v", "-bio_pair", "-tls1", "-cipher", "ADH", "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit anonymous DH, multiple handshakes');
{
SKIP: {
skip "skipping RSA tests", 2
- if (run(app(["openssl", "no-rsa"], stdout => undef)));
+ if $no_rsa;
ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-no_dhe", "-no_ecdhe", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, no (EC)DHE, multiple handshakes');
skip "skipping RSA+DHE tests", 1
- if (run(app(["openssl", "no-dhparam"], stdout => undef)));
+ if $no_dh;
ok(run(test(["ssltest", "-v", "-bio_pair", "-tls1", "-s_cert", top_file("apps","server2.pem"), "-dhe1024dsa", "-num", "10", "-f", "-time", @extra])),
'test tlsv1 with 1024bit RSA, 1024bit DHE, multiple handshakes');
{
SKIP: {
skip "skipping SRP tests", 4
- if run(app(["openssl", "no-srp"], stdout => undef));
+ if $no_srp;
ok(run(test([@ssltest, "-tls1", "-cipher", "SRP", "-srpuser", "test", "-srppass", "abc123"])),
'test tls1 with SRP');