[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-23 14:20:51
Message-ID: 20071223142051.312AA1EAE83D () 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:   23-Dec-2007 15:20:50
  Branch: OpenSSL-fips-0_9_8-stable        Handle: 2007122314205000

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

  Log:
    Add more tree sanity checks. Make sure verifies must produce at least one
    successful output. Fix typos.

  Summary:
    Revision    Changes     Path
    1.1.2.3     +44 -11     openssl/fips/fipsalgtest.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openssl/fips/fipsalgtest.pl
  ============================================================================
  $ cvs diff -u -r1.1.2.2 -r1.1.2.3 fipsalgtest.pl
  --- openssl/fips/fipsalgtest.pl	23 Dec 2007 00:53:55 -0000	1.1.2.2
  +++ openssl/fips/fipsalgtest.pl	23 Dec 2007 14:20:50 -0000	1.1.2.3
  @@ -321,11 +321,12 @@
   my $shwrap_prefix;
   my $debug          = 0;
   my $quiet          = 0;
  +my $notest         = 0;
   my $verify         = 1;
   my $rspdir         = "rsp";
   my $ignore_missing = 0;
  +my $ignore_bogus   = 1;
   my $rspignore      = 0;
  -my @bogus          = ();      # list of unmatched *.rsp files
   my $bufout         = '';
   
   foreach (@ARGV) {
  @@ -341,9 +342,15 @@
       elsif ( $_ eq "--ignore-missing" ) {
           $ignore_missing = 1;
       }
  +    elsif ( $_ eq "--ignore-bogus" ) {
  +        $ignore_bogus = 1;
  +    }
       elsif ( $_ eq "--generate" ) {
           $verify = 0;
       }
  +    elsif ( $_ eq "--notest" ) {
  +        $notest = 1;
  +    }
       elsif ( $_ eq "--quiet" ) {
           $quiet = 1;
       }
  @@ -412,6 +419,8 @@
   my ( $runerr, $cmperr, $cmpok, $scheckrunerr, $scheckerr, $scheckok, $skipcnt )
     = ( 0, 0, 0, 0, 0, 0 );
   
  +exit (0) if $notest;
  +
   run_tests( $verify, $win32, $tprefix, $filter, $tvdir );
   
   if ($verify) {
  @@ -420,7 +429,7 @@
       print "Algorithm test program execution failures: $runerr\n";
       print "Test comparisons successful:               $cmpok\n";
       print "Test comparisons failed:                   $cmperr\n";
  -    print "Test sanity checks succeessul:             $scheckok\n";
  +    print "Test sanity checks successful:             $scheckok\n";
       print "Test sanity checks failed:                 $scheckerr\n";
       print "Sanity check program execution failures:   $scheckrunerr\n";
   
  @@ -442,9 +451,9 @@
   	--filter=<regexp>
   	--onedir <dirname>          Assume all components in current directory
   	--rspdir=<dirname>          Name of subdirectories containing *.rsp files, default "resp"
  -	--rspignore                 Ignore any bogus *.rsp files
   	--shwrap_prefix=<prefix>
   	--tprefix=<prefix>
  +	--ignore-bogus              Ignore duplicate or bogus files
   	--ignore-missing            Ignore missing test files
   	--quiet                     Shhh....
   	--generate                  Generate algorithm test output
  @@ -495,21 +504,35 @@
               if (/\/([^\/]*)\.rsp$/) {
                   $testname = fix_pss( $1, $_ );
                   if ( exists $fips_tests{$testname} ) {
  -                    $fips_files{$testname}->[1] = $_;
  +                    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 "ERROR: bogus file $_\n";
  -                    push @bogus, $_;
  +                    print STDERR "WARNING: bogus file $_\n";
  +                    $nbogus++;
                   }
               }
               next unless /$filter.*\.req$/i;
               if (/\/([^\/]*)\.req$/) {
                   $testname = fix_pss( $1, $_ );
                   if ( exists $fips_tests{$testname} ) {
  -                    $fips_files{$testname}->[0] = $_;
  +                    if ($fips_files{$testname}->[0] eq "") {
  +                        $fips_files{$testname}->[0] = $_;
  +		    }
  +		    else {
  +                        print STDERR "WARNING: duplicate request file $_ for test $testname\n";
  +			$nbogus++;
  +		    }
  +			
                   }
                   elsif ( !/SHAmix\.req$/ ) {
                       print STDERR "WARNING: unrecognized filename $_\n";
  +                    $nbogus++;
                   }
               }
           }
  @@ -564,7 +587,11 @@
           print STDERR "ERROR: test vector file set not complete\n";
           exit(1) unless $ignore_missing;
       }
  -    elsif ($debug) {
  +    if ($nbogus) {
  +	print STDERR "ERROR: $nbogus bogus or duplicate request and response files\n";
  +        exit(1) unless $ignore_bogus;
  +    }
  +    if ($debug && !$nbogus && !$bad) {
           print STDERR "test vector file set complete\n";
       }
   }
  @@ -639,7 +666,7 @@
                   if ( $fcount || $debug ) {
                       print STDERR "DEBUG: $tname, Pass=$pcount, Fail=$fcount\n";
                   }
  -                if ($fcount) {
  +                if ($fcount || !$pcount) {
                       $scheckerr++;
                   }
                   else {
  @@ -662,8 +689,14 @@
       my ( $tname, $rsp, $tst ) = @_;
       my ( $rspf,    $tstf );
       my ( $rspline, $tstline );
  -    open $rspf, $rsp;
  -    open $tstf, $tst;
  +    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);
           $tstline = next_line($tstf);
  @@ .
______________________________________________________________________
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