From 1d7cec1013df77013910546e6b4577513deda3f0 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Mon, 29 Jan 2007 00:21:08 +0000 Subject: More options to allow directory locations to be specified in mkfipsscr.pl script. Make AES/DES algorithm test programs handle Win32 path separator. Switch off verbose mode in AES test program. --- fips-1.0/aes/fips_aesavs.c | 6 +++- fips-1.0/des/fips_desmovs.c | 4 +++ fips-1.0/mkfipsscr.pl | 74 +++++++++++++++++++++++++++++++++++++-------- 3 files changed, 70 insertions(+), 14 deletions(-) diff --git a/fips-1.0/aes/fips_aesavs.c b/fips-1.0/aes/fips_aesavs.c index ac155e926d..62196516d0 100644 --- a/fips-1.0/aes/fips_aesavs.c +++ b/fips-1.0/aes/fips_aesavs.c @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) #define AES_BLOCK_SIZE 16 -#define VERBOSE 1 +#define VERBOSE 0 /*-----------------------------------------------*/ @@ -727,6 +727,10 @@ int proc_file(char *rqfile) } strcpy(rfn,afn); rp=strstr(rfn,"req/"); +#ifdef OPENSSL_SYS_WIN32 + if (!rp) + rp=strstr(rfn,"req\\"); +#endif assert(rp); memcpy(rp,"rsp",3); rp = strstr(rfn, ".req"); diff --git a/fips-1.0/des/fips_desmovs.c b/fips-1.0/des/fips_desmovs.c index 900e800320..5eaf297d2e 100644 --- a/fips-1.0/des/fips_desmovs.c +++ b/fips-1.0/des/fips_desmovs.c @@ -590,6 +590,10 @@ int proc_file(char *rqfile) } strcpy(rfn,afn); rp=strstr(rfn,"req/"); +#ifdef OPENSSL_SYS_WIN32 + if (!rp) + rp=strstr(rfn,"req\\"); +#endif assert(rp); memcpy(rp,"rsp",3); rp = strstr(rfn, ".req"); diff --git a/fips-1.0/mkfipsscr.pl b/fips-1.0/mkfipsscr.pl index b3cc011504..df5161160f 100644 --- a/fips-1.0/mkfipsscr.pl +++ b/fips-1.0/mkfipsscr.pl @@ -60,8 +60,12 @@ my @fips_tests = ( my $lnum = 0; my $win32 = 0; -my $tvdir = "testvectors"; +my $onedir = 0; my $ltdir = ""; +my $tvdir; +my $tvprefix; +my $tprefix; +my $shwrap_prefix; foreach (@ARGV) { @@ -69,15 +73,48 @@ foreach (@ARGV) { $win32 = 1; } + elsif ($_ eq "--onedir") + { + $onedir = 1; + } elsif (/--dir=(.*)$/) { $tvdir = $1; } + elsif (/--tprefix=(.*)$/) + { + $tprefix = $1; + } + elsif (/--tvprefix=(.*)$/) + { + $tvprefix = $1; + } + elsif (/--shwrap_prefix=(.*)$/) + { + $shwrap_prefix = $1; + } + elsif (/--outfile=(.*)$/) + { + $outfile = $1; + } } +$tvdir = "testvectors" unless defined $tvdir; +$shwrap_prefix = "../util/" unless defined $shwrap_prefix; + if ($win32) { - open(OUT, ">fipstests.bat"); + if ($onedir) + { + $tvprefix = "" unless defined $tvprefix; + } + else + { + $tvprefix = "..\\fips-1.0\\" unless defined $tvprefix; + } + $tprefix = ".\\" unless defined $tprefix; + $outfile = "fipstests.bat" unless defined $outfile; + open(OUT, ">$outfile"); print OUT <fipstests.sh"); + $tvprefix = "" unless defined $tvprefix; + if ($onedir) + { + $tprefix = "./" unless defined $tprefix; + } + else + { + $tprefix = "../test/" unless defined $tprefix; + } + $outfile = "fipstests.sh" unless defined $outfile; + open(OUT, ">$outfile"); -print OUT <) + foreach(<$tvprefix$tvdir/$tdir/req/*.req>) { if ($win32) { - print OUT ".\\$tcmd ../fips-1.0/${_}\n"; + $_ =~ tr|/|\\|; + print OUT "$tprefix$tcmd $_\n"; } else { print OUT < $rsp\n"; + my $req = "$tvprefix$tvdir\\$tdir\\req\\$fprefix.req"; + my $rsp = "$tvprefix$tvdir\\$tdir\\rsp\\$fprefix.rsp"; + print OUT "$tprefix$tcmd < $req > $rsp\n"; END } else { - my $req = "$tvdir/$tdir/req/$fprefix.req"; + my $req = "tvdir/$tdir/req/$fprefix.req"; my $rsp = "$tvdir/$tdir/rsp/$fprefix.rsp"; print OUT < $rsp; fi +if [ -f $req ] ; then ${shwrap_prefix}shlib_wrap.sh $tprefix$tcmd < $req > $rsp; fi END } } -- cgit v1.2.3