List Info

Thread: OpenSSL: OpenSSL-fips-0_9_8-stable: openssl/fips/ fipsalgtest.pl




OpenSSL: OpenSSL-fips-0_9_8-stable: openssl/fips/ fipsalgtest.pl
country flaguser name
Germany
2007-12-24 11:45:08
  OpenSSL CVS Repository
  http://cvs.openssl.org/
 
____________________________________________________________
________________

  Server: cvs.openssl.org                  Name:   Dr.
Stephen Henson
  Root:   /v/openssl/cvs                   Email:  steveopenssl.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 ? "" :
"$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:      
 $skipcntn";
       print "Algorithm test program execution
failures: $runerrn";
       print "Test comparisons successful:             
 $cmpokn";
   -440,6 +433,18 
           print "***ALL TESTS SUCCESSFUL***n";
       }
   }
  +else {
  +    print "ALGORITHM TEST SUMMARY REPORT:n";
  +    print "Tests skipped due to missing files:      
 $skipcntn";
  +    print "Algorithm test program execution
failures: $runerrn";
  +
  +    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
missingn";
  -	exit (1);
  +        exit(1);
       }
       elsif ($debug) {
           print STDERR "Executable sanity check passed
OKn";
   -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 $testnamen";
  -			$nbogus++;
  -		    }
  +                    }
  +                    else {
  +                        print STDERR
  +"WARNING: duplicate response file $_ for test
$testnamen";
  +                        $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 $testnamen";
  -			$nbogus++;
  -		    }
  -			
  +                    }
  +                    else {
  +                        print STDERR
  +"WARNING: duplicate request file $_ for test
$testnamen";
  +                        $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 filesn";
  +        print STDERR
  +          "ERROR: $nbogus bogus or duplicate request
and response filesn";
           exit(1) unless $ignore_bogus;
       }
  -    if ($debug && !$nbogus && !$bad) {
  +    if ( $debug && !$nbogus && !$bad ) {
           print STDERR "test vector file set
completen";
       }
   }
   -618,17 +626,33 
               $skipcnt++;
               next;
           }
  +        elsif ( !$verify ) {
  +            if ( $rsp ne "" ) {
  +                print STDERR "WARNING: Response file
for $tname deletedn";
  +                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 $outdirn" 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
$tnamen" if ( $debug && !$verify );
           system($cmd);
           if ( $? != 0 ) {
  -            print STDERR "WARNING: error executing
test $tnamen";
  +            print STDERR
  +              "WARNING: error executing test $tname
for command: $cmdn";
               $runerr++;
               next;
           }
   -666,7 +690,7 
                   if ( $fcount || $debug ) {
                       print STDERR "DEBUG: $tname,
Pass=$pcount, Fail=$fcountn";
                   }
  -                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
$rspn";
  -	return 0;
  -    }
  -    if (!open ($tstf, $tst)) {
  -	print STDERR "ERROR: can't open output file
$tstn";
  -	return 0;
  +    if ( !open( $rspf, $rsp ) ) {
  +        print STDERR "ERROR: can't open request file
$rspn";
  +        return 0;
  +    }
  +    if ( !open( $tstf, $tst ) ) {
  +        print STDERR "ERROR: can't open output file
$tstn";
  +        return 0;
       }
       for ( ; ; ) {
           $rspline = next_line($rspf);
   .
____________________________________________________________
__________
OpenSSL Project                                 http://www.openssl.org
CVS Repository Commit List                    
openssl-cvsopenssl.org
Automated List Manager                          
majordomoopenssl.org

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )