#!/usr/bin/perl -w
# Perl utility to run or verify FIPS 140-2 CAVP algorithm tests based on the
# pathnames of input algorithm test files actually present (the unqualified
# file names are consistent but the pathnames are not).
#
# FIPS test definitions
# List of all the unqualified file names we expect and command lines to run
# DSA tests
my @fips_dsa_test_list = (
"DSA",
[ "PQGGen", "fips_dssvs pqg", "path:[^C]DSA/.*PQGGen" ],
[ "KeyPair", "fips_dssvs keypair", "path:[^C]DSA/.*KeyPair" ],
[ "SigGen", "fips_dssvs siggen", "path:[^C]DSA/.*SigGen" ],
[ "SigVer", "fips_dssvs sigver", "path:[^C]DSA/.*SigVer" ]
);
my @fips_dsa_pqgver_test_list = (
"DSA",
[ "PQGVer", "fips_dssvs pqgver"]
);
# DSA2 tests
my @fips_dsa2_test_list = (
"DSA2",
[ "PQGGen", "fips_dssvs pqg", "path:[^C]DSA2/.*PQGGen" ],
[ "KeyPair", "fips_dssvs keypair", "path:[^C]DSA2/.*KeyPair" ],
[ "SigGen", "fips_dssvs siggen", "path:[^C]DSA2/.*SigGen" ],
[ "SigVer", "fips_dssvs sigver", "path:[^C]DSA2/.*SigVer" ],
[ "PQGVer", "fips_dssvs pqgver", "file:L\\s*=.*N\\s*=" ]
);
# ECDSA and ECDSA2 tests
my @fips_ecdsa_test_list = (
"ECDSA",
[ "KeyPair", "fips_ecdsavs KeyPair", "path:/ECDSA/.*KeyPair" ],
[ "PKV", "fips_ecdsavs PKV", "path:/ECDSA/.*PKV" ],
[ "SigGen", "fips_ecdsavs SigGen", "path:/ECDSA/.*SigGen" ],
[ "SigVer", "fips_ecdsavs SigVer", "path:/ECDSA/.*SigVer" ],
);
my @fips_ecdsa2_test_list = (
"ECDSA2",
[ "KeyPair", "fips_ecdsavs KeyPair", "path:/ECDSA2/.*KeyPair" ],
[ "PKV", "fips_ecdsavs PKV", "path:/ECDSA2/.*PKV" ],
[ "SigGen", "fips_ecdsavs SigGen", "path:/ECDSA2/.*SigGen" ],
[ "SigVer", "fips_ecdsavs SigVer", "path:/ECDSA2/.*SigVer" ],
);
# RSA tests
my @fips_rsa_test_list = (
"RSA",
[ "SigGen15", "fips_rsastest" ],
[ "SigVer15", "fips_rsavtest" ],
[ "SigVer(X9.31)", "fips_rsavtest -x931", 'file:9\.31' ],
[ "KeyGenRSA", "fips_rsagtest" ],
[ "SigGen(X9.31)", "fips_rsastest -x931" , 'file:9\.31']
);
# Special cases for PSS. The filename itself is
# not sufficient to determine the test. Addditionally we
# need to examine the file contents to determine the salt length
# In these cases the test filename has (saltlen) appended.
# RSA PSS salt length 0 tests
my @fips_rsa_pss0_test_list = (
"RSA",