[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openssl-cvs
Subject:    [CVS] OpenSSL: OpenSSL-fips-0_9_8-stable: openssl/fips/ fipsalgtest.pl
From:       "Dr. Stephen Henson" <steve () openssl ! org>
Date:       2007-12-24 17:45:08
Message-ID: 20071224174508.B8F201EAE83D () master ! openssl ! org
[Download RAW message or body]

  OpenSSL CVS Repository
  http://cvs.openssl.org/
  ____________________________________________________________________________

  Server: cvs.openssl.org                  Name:   Dr. Stephen Henson
  Root:   /v/openssl/cvs                   Email:  steve@openssl.org
  Module: openssl                          Date:   24-Dec-2007 18:45:08
  Branch: OpenSSL-fips-0_9_8-stable        Handle: 2007122417450800

  Modified files:           (Branch: OpenSSL-fips-0_9_8-stable)
    openssl/fips            fipsalgtest.pl

  Log:
    Tidy up fipsalgtest.pl and add initial support for generation.

  Summary:
    Revision    Changes     Path
    1.1.2.5     +62 -38     openssl/fips/fipsalgtest.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openssl/fips/fipsalgtest.pl
  ============================================================================
  $ cvs diff -u -r1.1.2.4 -r1.1.2.5 fipsalgtest.pl
  --- openssl/fips/fipsalgtest.pl	23 Dec 2007 20:32:06 -0000	1.1.2.4
  +++ openssl/fips/fipsalgtest.pl	24 Dec 2007 17:45:08 -0000	1.1.2.5
  @@ -303,13 +303,11 @@
   #
   
   my %verify_special = (
  -    "PQGGen" => "fips_dssvs pqgver",
  -
  -    "KeyPair"	    => "fips_dssvs keyver",
  +    "PQGGen"        => "fips_dssvs pqgver",
  +    "KeyPair"       => "fips_dssvs keyver",
       "SigGen"        => "fips_dssvs sigver",
       "SigGen15"      => "fips_rsavtest",
       "SigGenRSA"     => "fips_rsavtest -x931",
  -    "SigGenPSS(0)"  => "fips_rsavtest -saltlen 0",
       "SigGenPSS(62)" => "fips_rsavtest -saltlen 62",
   );
   
  @@ -326,7 +324,6 @@
   my $rspdir         = "rsp";
   my $ignore_missing = 0;
   my $ignore_bogus   = 1;
  -my $rspignore      = 0;
   my $bufout         = '';
   
   foreach (@ARGV) {
  @@ -360,9 +357,6 @@
       elsif (/--rspdir=(.*)$/) {
           $rspdir = $1;
       }
  -    elsif (/--rspignore$/) {
  -        $rspignore = 1;
  -    }
       elsif (/--tprefix=(.*)$/) {
           $tprefix = $1;
       }
  @@ -401,7 +395,6 @@
       }
   }
   
  -
   sanity_check_exe( $win32, $tprefix, $shwrap_prefix );
   
   my $cmd_prefix = $win32 ? "" : "${shwrap_prefix}shlib_wrap.sh ";
  @@ -419,12 +412,12 @@
   my ( $runerr, $cmperr, $cmpok, $scheckrunerr, $scheckerr, $scheckok, $skipcnt )
     = ( 0, 0, 0, 0, 0, 0 );
   
  -exit (0) if $notest;
  +exit(0) if $notest;
   
   run_tests( $verify, $win32, $tprefix, $filter, $tvdir );
   
   if ($verify) {
  -    print "TEST SUMMARY REPORT:\n";
  +    print "ALGORITHM TEST VERIFY SUMMARY REPORT:\n";
       print "Tests skipped due to missing files:        $skipcnt\n";
       print "Algorithm test program execution failures: $runerr\n";
       print "Test comparisons successful:               $cmpok\n";
  @@ -440,6 +433,18 @@
           print "***ALL TESTS SUCCESSFUL***\n";
       }
   }
  +else {
  +    print "ALGORITHM TEST SUMMARY REPORT:\n";
  +    print "Tests skipped due to missing files:        $skipcnt\n";
  +    print "Algorithm test program execution failures: $runerr\n";
  +
  +    if ($runerr) {
  +        print "***TEST FAILURE***\n";
  +    }
  +    else {
  +        print "***ALL TESTS SUCCESSFUL***\n";
  +    }
  +}
   
   #--------------------------------
   sub Help {
  @@ -457,7 +462,7 @@
   	--ignore-missing            Ignore missing test files
   	--quiet                     Shhh....
   	--generate                  Generate algorithm test output
  -	--win32                     Generate script for Win32 environment
  +	--win32                     Win32 environment
   EOF
   }
   
  @@ -484,7 +489,7 @@
       }
       if ($bad) {
           print STDERR "FATAL ERROR: executables missing\n";
  -	exit (1);
  +        exit(1);
       }
       elsif ($debug) {
           print STDERR "Executable sanity check passed OK\n";
  @@ -504,13 +509,14 @@
               if (/\/([^\/]*)\.rsp$/) {
                   $testname = fix_pss( $1, $_ );
                   if ( exists $fips_tests{$testname} ) {
  -                    if ($fips_files{$testname}->[1] eq "") {
  +                    if ( $fips_files{$testname}->[1] eq "" ) {
                           $fips_files{$testname}->[1] = $_;
  -		    }
  -		    else {
  -                        print STDERR "WARNING: duplicate response file $_ for test $testname\n";
  -			$nbogus++;
  -		    }
  +                    }
  +                    else {
  +                        print STDERR
  +"WARNING: duplicate response file $_ for test $testname\n";
  +                        $nbogus++;
  +                    }
                   }
                   else {
                       print STDERR "WARNING: bogus file $_\n";
  @@ -521,14 +527,15 @@
               if (/\/([^\/]*)\.req$/) {
                   $testname = fix_pss( $1, $_ );
                   if ( exists $fips_tests{$testname} ) {
  -                    if ($fips_files{$testname}->[0] eq "") {
  +                    if ( $fips_files{$testname}->[0] eq "" ) {
                           $fips_files{$testname}->[0] = $_;
  -		    }
  -		    else {
  -                        print STDERR "WARNING: duplicate request file $_ for test $testname\n";
  -			$nbogus++;
  -		    }
  -			
  +                    }
  +                    else {
  +                        print STDERR
  +"WARNING: duplicate request file $_ for test $testname\n";
  +                        $nbogus++;
  +                    }
  +
                   }
                   elsif ( !/SHAmix\.req$/ ) {
                       print STDERR "WARNING: unrecognized filename $_\n";
  @@ -588,10 +595,11 @@
           exit(1) unless $ignore_missing;
       }
       if ($nbogus) {
  -	print STDERR "ERROR: $nbogus bogus or duplicate request and response files\n";
  +        print STDERR
  +          "ERROR: $nbogus bogus or duplicate request and response files\n";
           exit(1) unless $ignore_bogus;
       }
  -    if ($debug && !$nbogus && !$bad) {
  +    if ( $debug && !$nbogus && !$bad ) {
           print STDERR "test vector file set complete\n";
       }
   }
  @@ -618,17 +626,33 @@
               $skipcnt++;
               next;
           }
  +        elsif ( !$verify ) {
  +            if ( $rsp ne "" ) {
  +                print STDERR "WARNING: Response file for $tname deleted\n";
  +                unlink $rsp;
  +            }
  +            $out = $req;
  +            $out =~ s|/req/(\S+)\.req|/$rspdir/$1.rsp|;
  +            my $outdir = $out;
  +            $outdir =~ s|/[^/]*$||;
  +            if ( !-d $outdir ) {
  +                print STDERR "DEBUG: Creating directory $outdir\n" if $debug;
  +                mkdir($outdir) || die "Can't create directory $outdir";
  +            }
  +        }
           my $tcmd = $fips_tests{$tname};
  -        my $cmd = "$cmd_prefix$tprefix$tcmd ";
  +        my $cmd  = "$cmd_prefix$tprefix$tcmd ";
           if ( $tcmd =~ /-f$/ ) {
               $cmd .= "$req $out";
           }
           else {
               $cmd .= "<$req >$out";
           }
  +        print STDERR "DEBUG: running test $tname\n" if ( $debug && !$verify );
           system($cmd);
           if ( $? != 0 ) {
  -            print STDERR "WARNING: error executing test $tname\n";
  +            print STDERR
  +              "WARNING: error executing test $tname for command: $cmd\n";
               $runerr++;
               next;
           }
  @@ -666,7 +690,7 @@
                   if ( $fcount || $debug ) {
                       print STDERR "DEBUG: $tname, Pass=$pcount, Fail=$fcount\n";
                   }
  -                if ($fcount || !$pcount) {
  +                if ( $fcount || !$pcount ) {
                       $scheckerr++;
                   }
                   else {
  @@ -689,13 +713,13 @@
       my ( $tname, $rsp, $tst ) = @_;
       my ( $rspf,    $tstf );
       my ( $rspline, $tstline );
  -    if (!open ($rspf, $rsp)) {
  -	print STDERR "ERROR: can't open request file $rsp\n";
  -	return 0;
  -    }
  -    if (!open ($tstf, $tst)) {
  -	print STDERR "ERROR: can't open output file $tst\n";
  -	return 0;
  +    if ( !open( $rspf, $rsp ) ) {
  +        print STDERR "ERROR: can't open request file $rsp\n";
  +        return 0;
  +    }
  +    if ( !open( $tstf, $tst ) ) {
  +        print STDERR "ERROR: can't open output file $tst\n";
  +        return 0;
       }
       for ( ; ; ) {
           $rspline = next_line($rspf);
  @@ .
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
CVS Repository Commit List                     openssl-cvs@openssl.org
Automated List Manager                           majordomo@openssl.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic