mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-08 23:13:38 +08:00
update test recipes
cd test/recipes sed -i "" 's/\"openssl\"/\"gmssl\"/g' *.t
This commit is contained in:
@@ -25,7 +25,7 @@ my $testsrc = srctop_file("test","recipes",basename($0));
|
||||
|
||||
my $test = catfile(".", "p");
|
||||
|
||||
my $cmd = "openssl";
|
||||
my $cmd = "gmssl";
|
||||
|
||||
my @ciphers =
|
||||
map { s/^\s+//; s/\s+$//; split /\s+/ }
|
||||
|
||||
@@ -21,24 +21,24 @@ setup("test_rehash");
|
||||
#If "openssl rehash -help" fails it's most likely because we're on a platform
|
||||
#that doesn't support the rehash command (e.g. Windows)
|
||||
plan skip_all => "test_rehash is not available on this platform"
|
||||
unless run(app(["openssl", "rehash", "-help"]));
|
||||
unless run(app(["gmssl", "rehash", "-help"]));
|
||||
|
||||
plan tests => 5;
|
||||
|
||||
indir "rehash.$$" => sub {
|
||||
prepare();
|
||||
ok(run(app(["openssl", "rehash", curdir()])),
|
||||
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||
'Testing normal rehash operations');
|
||||
}, create => 1, cleanup => 1;
|
||||
|
||||
indir "rehash.$$" => sub {
|
||||
prepare(sub { chmod 400, $_ foreach (@_); });
|
||||
ok(run(app(["openssl", "rehash", curdir()])),
|
||||
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||
'Testing rehash operations on readonly files');
|
||||
}, create => 1, cleanup => 1;
|
||||
|
||||
indir "rehash.$$" => sub {
|
||||
ok(run(app(["openssl", "rehash", curdir()])),
|
||||
ok(run(app(["gmssl", "rehash", curdir()])),
|
||||
'Testing rehash operations on empty directory');
|
||||
}, create => 1, cleanup => 1;
|
||||
|
||||
@@ -51,7 +51,7 @@ indir "rehash.$$" => sub {
|
||||
close FOO;
|
||||
skip "It's pointless to run the next test as root", 1;
|
||||
}
|
||||
isnt(run(app(["openssl", "rehash", curdir()])), 1,
|
||||
isnt(run(app(["gmssl", "rehash", curdir()])), 1,
|
||||
'Testing rehash operations on readonly directory');
|
||||
}
|
||||
chmod 0700, curdir(); # make it writable again, so cleanup works
|
||||
|
||||
@@ -65,7 +65,7 @@ my @handmessages = (
|
||||
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
undef,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ plan skip_all => "$test_name needs TLSv1.2 enabled"
|
||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
\&add_empty_recs_filter,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ my $ticketseen = 0;
|
||||
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
undef,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ plan skip_all => "$test_name needs TLS enabled"
|
||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
\&ske_0_p_filter,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -29,7 +29,7 @@ plan skip_all => "$test_name needs TLS enabled"
|
||||
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
\&vers_tolerance_filter,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ my $fullhand = 0;
|
||||
|
||||
my $proxy = TLSProxy::Proxy->new(
|
||||
\&extms_filter,
|
||||
cmdstr(app(["openssl"]), display => 1),
|
||||
cmdstr(app(["gmssl"]), display => 1),
|
||||
srctop_file("apps", "server.pem"),
|
||||
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
||||
);
|
||||
|
||||
@@ -16,7 +16,7 @@ use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file/;
|
||||
|
||||
setup("test_ca");
|
||||
|
||||
$ENV{OPENSSL} = cmdstr(app(["openssl"]), display => 1);
|
||||
$ENV{OPENSSL} = cmdstr(app(["gmssl"]), display => 1);
|
||||
my $std_openssl_cnf =
|
||||
srctop_file("apps", $^O eq "VMS" ? "openssl-vms.cnf" : "openssl.cnf");
|
||||
|
||||
|
||||
@@ -391,8 +391,8 @@ subtest "CMS => PKCS#7 compatibility tests\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "smime", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "smime", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
@@ -406,8 +406,8 @@ subtest "CMS <= PKCS#7 compatibility tests\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "smime", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "smime", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
@@ -422,8 +422,8 @@ subtest "CMS <=> CMS consistency tests\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
@@ -433,8 +433,8 @@ subtest "CMS <=> CMS consistency tests\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
@@ -450,8 +450,8 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
@@ -467,8 +467,8 @@ subtest "CMS <=> CMS consistency tests, modified key parameters\n" => sub {
|
||||
my $skip_reason = check_availability($$_[0]);
|
||||
skip $skip_reason, 1 if $skip_reason;
|
||||
|
||||
ok(run(app(["openssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["openssl", "cms", @{$$_[2]}]))
|
||||
ok(run(app(["gmssl", "cms", @{$$_[1]}]))
|
||||
&& run(app(["gmssl", "cms", @{$$_[2]}]))
|
||||
&& compare_text($smcont, "smtst.txt") == 0,
|
||||
$$_[0]);
|
||||
}
|
||||
|
||||
@@ -31,11 +31,11 @@ sub test_ocsp {
|
||||
my $CAfile = shift;
|
||||
my $expected_exit = shift;
|
||||
|
||||
run(app(["openssl", "base64", "-d",
|
||||
run(app(["gmssl", "base64", "-d",
|
||||
"-in", catfile($ocspdir,$inputfile),
|
||||
"-out", "ocsp-resp-fff.dat"]));
|
||||
with({ exit_checker => sub { return shift == $expected_exit; } },
|
||||
sub { ok(run(app(["openssl", "ocsp", "-respin", "ocsp-resp-fff.dat",
|
||||
sub { ok(run(app(["gmssl", "ocsp", "-respin", "ocsp-resp-fff.dat",
|
||||
"-partial_chain", @check_time,
|
||||
"-CAfile", catfile($ocspdir, $CAfile),
|
||||
"-verify_other", catfile($ocspdir, $CAfile),
|
||||
|
||||
@@ -58,7 +58,7 @@ $ENV{OPENSSL_WIN32_UTF8}=1;
|
||||
plan tests => 1;
|
||||
|
||||
# just see that we can read shibboleth.pfx protected with $pass
|
||||
ok(run(app(["openssl", "pkcs12", "-noout",
|
||||
ok(run(app(["gmssl", "pkcs12", "-noout",
|
||||
"-password", "pass:$pass",
|
||||
"-in", srctop_file("test", "shibboleth.pfx")])),
|
||||
"test_pkcs12");
|
||||
|
||||
@@ -33,10 +33,10 @@ plan skip_all => "No SSL/TLS/DTLS protocol is support by this OpenSSL build"
|
||||
if $no_anytls && $no_anydtls;
|
||||
|
||||
my $digest = "-sha1";
|
||||
my @reqcmd = ("openssl", "req");
|
||||
my @x509cmd = ("openssl", "x509", $digest);
|
||||
my @verifycmd = ("openssl", "verify");
|
||||
my @gendsacmd = ("openssl", "gendsa");
|
||||
my @reqcmd = ("gmssl", "req");
|
||||
my @x509cmd = ("gmssl", "x509", $digest);
|
||||
my @verifycmd = ("gmssl", "verify");
|
||||
my @gendsacmd = ("gmssl", "gendsa");
|
||||
my $dummycnf = srctop_file("apps", "openssl.cnf");
|
||||
|
||||
my $CAkey = "keyCA.ss";
|
||||
@@ -225,7 +225,7 @@ sub testss {
|
||||
SKIP: {
|
||||
$ENV{CN2} = "ECDSA Certificate";
|
||||
skip 'failure', 4 unless
|
||||
ok(run(app(["openssl", "ecparam", "-name", "P-256",
|
||||
ok(run(app(["gmssl", "ecparam", "-name", "P-256",
|
||||
"-out", "ecp.ss"])),
|
||||
"make EC parameters");
|
||||
skip 'failure', 3 unless
|
||||
@@ -321,7 +321,7 @@ sub testssl {
|
||||
my $serverinfo = srctop_file("test","serverinfo.pem");
|
||||
|
||||
my $dsa_cert = 0;
|
||||
if (grep /DSA Public Key/, run(app(["openssl", "x509", "-in", $cert,
|
||||
if (grep /DSA Public Key/, run(app(["gmssl", "x509", "-in", $cert,
|
||||
"-text", "-noout"]), capture => 1)) {
|
||||
$dsa_cert = 1;
|
||||
}
|
||||
@@ -452,7 +452,7 @@ sub testssl {
|
||||
my %ciphersuites =
|
||||
map { my @c =
|
||||
map { split(/:/, $_) }
|
||||
run(app(["openssl", "ciphers", "${_}:$ciphers"]),
|
||||
run(app(["gmssl", "ciphers", "${_}:$ciphers"]),
|
||||
capture => 1);
|
||||
map { s/\R//; } @c; # chomp @c;
|
||||
$protocolciphersuitcount += scalar @c;
|
||||
|
||||
@@ -25,7 +25,7 @@ plan skip_all => "TS is not supported by this OpenSSL build"
|
||||
# here, however, to be available in all subroutines.
|
||||
my $testtsa;
|
||||
my $CAtsa;
|
||||
my @RUN = ("openssl", "ts");
|
||||
my @RUN = ("gmssl", "ts");
|
||||
|
||||
sub create_tsa_cert {
|
||||
my $INDEX = shift;
|
||||
@@ -33,11 +33,11 @@ sub create_tsa_cert {
|
||||
my $r = 1;
|
||||
$ENV{TSDNSECT} = "ts_cert_dn";
|
||||
|
||||
ok(run(app(["openssl", "req", "-new",
|
||||
ok(run(app(["gmssl", "req", "-new",
|
||||
"-out", "tsa_req${INDEX}.pem",
|
||||
"-keyout", "tsa_key${INDEX}.pem"])));
|
||||
note "using extension $EXT";
|
||||
ok(run(app(["openssl", "x509", "-req",
|
||||
ok(run(app(["gmssl", "x509", "-req",
|
||||
"-in", "tsa_req${INDEX}.pem",
|
||||
"-out", "tsa_cert${INDEX}.pem",
|
||||
"-CA", "tsaca.pem", "-CAkey", "tsacakey.pem",
|
||||
@@ -86,14 +86,14 @@ indir "tsa" => sub
|
||||
$ENV{OPENSSL_CONF} = srctop_file("test", "CAtsa.cnf");
|
||||
# Because that's what ../apps/CA.pl really looks at
|
||||
$ENV{OPENSSL_CONFIG} = "-config ".$ENV{OPENSSL_CONF};
|
||||
$ENV{OPENSSL} = cmdstr(app(["openssl"]), display => 1);
|
||||
$ENV{OPENSSL} = cmdstr(app(["gmssl"]), display => 1);
|
||||
$testtsa = srctop_file("test", "recipes", "80-test_tsa.t");
|
||||
$CAtsa = srctop_file("test", "CAtsa.cnf");
|
||||
|
||||
SKIP: {
|
||||
$ENV{TSDNSECT} = "ts_ca_dn";
|
||||
skip "failed", 19
|
||||
unless ok(run(app(["openssl", "req", "-new", "-x509", "-nodes",
|
||||
unless ok(run(app(["gmssl", "req", "-new", "-x509", "-nodes",
|
||||
"-out", "tsaca.pem", "-keyout", "tsacakey.pem"])),
|
||||
'creating a new CA for the TSA tests');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user