Don't use TPREFIX shell variable for minimal script.
[oweals/openssl.git] / fips / fipsalgtest.pl
index 1abbc2fb5b5c8363d46645f04f96cb8cf7f29014..2f6c45f9edfe1aaab75a560a93a649eb4827642d 100644 (file)
@@ -487,6 +487,7 @@ my %verify_special = (
     "RSA:SigGenRSA"     => "fips_rsavtest -x931",
     "RSA:SigGenPSS(0)"  => "fips_rsavtest -saltlen 0",
     "RSA:SigGenPSS(62)" => "fips_rsavtest -saltlen 62",
+    "ECDH Ephemeral Primitives Only:KAS_ECC_CDH_PrimitiveTest" => "skip"
 );
 
 my $win32  = $^O =~ m/mswin/i;
@@ -509,6 +510,7 @@ my $no_warn_missing = 0;
 my $no_warn_bogus = 0;
 my $rmcmd = "rm -rf";
 my $mkcmd = "mkdir";
+my $cmpall = 0;
 
 my %fips_enabled = (
     dsa         => 1,
@@ -569,6 +571,9 @@ foreach (@ARGV) {
     } elsif ( $_ eq "--generate" ) {
         $verify = 0;
     }
+    elsif ( $_ eq "--compare-all" ) {
+        $cmpall = 1;
+    }
     elsif ( $_ eq "--notest" ) {
         $notest = 1;
     }
@@ -751,6 +756,10 @@ $cmd: generate run CAVP algorithm tests
        --ignore-missing            Ignore missing test files
        --quiet                     Shhh....
        --generate                  Generate algorithm test output
+       --generate-script=<file>    Create shell script of test commands
+       --minimal-script            Keep script commands to a minimum
+       --mkdir=<command>           Command to make directories in scripts
+       --rm=<command>              Command to remove directories in scripts
        --win32                     Win32 environment
        --enable-<alg>              Enable algorithm set <alg>.
        --disable-<alg>             Disable algorithm set <alg>.
@@ -929,6 +938,7 @@ sub run_tests {
     my ( $tname, $tref );
     my $bad = 0;
     my $lastdir = "";
+    $stprefix = $tprefix unless defined $stprefix;
     if ($outfile ne "") {
        open OUT, ">$outfile" || die "Can't open $outfile";
     }
@@ -944,7 +954,6 @@ echo Running Algorithm Tests
 
 END
        } else {
-       $stprefix = $tprefix unless defined $stprefix;
            print OUT <<END;
 #!/bin/sh
 
@@ -1032,8 +1041,12 @@ END
         my $cmd = "$tcmd \"$req\" \"$out\"";
         print STDERR "DEBUG: running test $tname\n" if ( $debug && !$verify );
        if ($outfile ne "") {
-           print OUT "echo \"    running $tname test\"\n" unless $minimal_script;
-           print OUT "\${TPREFIX}$cmd\n";
+           if ($minimal_script) {
+               print OUT "$stprefix$cmd\n";
+           } else {
+               print OUT "echo \"    running $tname test\"\n" unless $minimal_script;
+               print OUT "\${TPREFIX}$cmd\n";
+           }
         } else {
             $cmd = "$tprefix$cmd";
             system($cmd);
@@ -1045,10 +1058,15 @@ END
             }
         }
         if ($verify) {
-            if ( exists $verify_special{"$ttype:$tname"} ) {
+            if ( exists $verify_special{"$ttype:$tname"} && !$cmpall) {
                 my $vout = $rsp;
                 $vout =~ s/\.rsp$/.ver/;
                 $tcmd = $verify_special{"$ttype:$tname"};
+               if ($tcmd eq "skip") {
+                       print STDERR "DEBUG: No verify possible: skipped.\n" if $debug;
+                       $scheckok++;
+                       next;
+               }
                 $cmd  = "$tprefix$tcmd ";
                 $cmd .= "\"$out\" \"$vout\"";
                 system($cmd);