New --rspdir option to mkfipsscr.pl to specify alternate output directory.

Modify fips_aesavs and fips_desmovs to support an optional output filename
with -f option.
This commit is contained in:
Dr. Stephen Henson 2007-09-21 18:00:24 +00:00
parent 5b75e1cff4
commit 98ced05c56
3 changed files with 50 additions and 32 deletions

View File

@ -541,7 +541,7 @@ int do_mct(char *amode,
# Fri Aug 30 04:07:22 PM
----------------------------*/
int proc_file(char *rqfile)
int proc_file(char *rqfile, char *rspfile)
{
char afn[256], rfn[256];
FILE *afp = NULL, *rfp = NULL;
@ -573,17 +573,21 @@ int proc_file(char *rqfile)
afn, strerror(errno));
return -1;
}
strcpy(rfn,afn);
rp=strstr(rfn,"req/");
if (!rspfile)
{
strcpy(rfn,afn);
rp=strstr(rfn,"req/");
#ifdef OPENSSL_SYS_WIN32
if (!rp)
rp=strstr(rfn,"req\\");
if (!rp)
rp=strstr(rfn,"req\\");
#endif
assert(rp);
memcpy(rp,"rsp",3);
rp = strstr(rfn, ".req");
memcpy(rp, ".rsp", 4);
if ((rfp = fopen(rfn, "w")) == NULL)
assert(rp);
memcpy(rp,"rsp",3);
rp = strstr(rfn, ".req");
memcpy(rp, ".rsp", 4);
rspfile = rfn;
}
if ((rfp = fopen(rspfile, "w")) == NULL)
{
printf("Cannot open file: %s, %s\n",
rfn, strerror(errno));
@ -852,7 +856,7 @@ int proc_file(char *rqfile)
--------------------------------------------------*/
int main(int argc, char **argv)
{
char *rqlist = "req.txt";
char *rqlist = "req.txt", *rspfile = NULL;
FILE *fp = NULL;
char fn[250] = "", rfn[256] = "";
int f_opt = 0, d_opt = 1;
@ -888,7 +892,10 @@ int main(int argc, char **argv)
if (d_opt)
rqlist = argv[2];
else
{
strcpy(fn, argv[2]);
rspfile = argv[3];
}
}
if (d_opt)
{ /* list of files (directory) */
@ -903,7 +910,7 @@ int main(int argc, char **argv)
strcpy(rfn, fn);
if (VERBOSE)
printf("Processing: %s\n", rfn);
if (proc_file(rfn))
if (proc_file(rfn, rspfile))
{
printf(">>> Processing failed for: %s <<<\n", rfn);
EXIT(1);
@ -915,7 +922,7 @@ int main(int argc, char **argv)
{
if (VERBOSE)
printf("Processing: %s\n", fn);
if (proc_file(fn))
if (proc_file(fn, rspfile))
{
printf(">>> Processing failed for: %s <<<\n", fn);
}

View File

@ -266,7 +266,7 @@ void do_mct(char *amode,
}
}
int proc_file(char *rqfile)
int proc_file(char *rqfile, char *rspfile)
{
char afn[256], rfn[256];
FILE *afp = NULL, *rfp = NULL;
@ -297,17 +297,21 @@ int proc_file(char *rqfile)
afn, strerror(errno));
return -1;
}
strcpy(rfn,afn);
rp=strstr(rfn,"req/");
if (!rspfile)
{
strcpy(rfn,afn);
rp=strstr(rfn,"req/");
#ifdef OPENSSL_SYS_WIN32
if (!rp)
rp=strstr(rfn,"req\\");
if (!rp)
rp=strstr(rfn,"req\\");
#endif
assert(rp);
memcpy(rp,"rsp",3);
rp = strstr(rfn, ".req");
memcpy(rp, ".rsp", 4);
if ((rfp = fopen(rfn, "w")) == NULL)
assert(rp);
memcpy(rp,"rsp",3);
rp = strstr(rfn, ".req");
memcpy(rp, ".rsp", 4);
rspfile = rfn;
}
if ((rfp = fopen(rspfile, "w")) == NULL)
{
printf("Cannot open file: %s, %s\n",
rfn, strerror(errno));
@ -623,7 +627,7 @@ int proc_file(char *rqfile)
--------------------------------------------------*/
int main(int argc, char **argv)
{
char *rqlist = "req.txt";
char *rqlist = "req.txt", *rspfile = NULL;
FILE *fp = NULL;
char fn[250] = "", rfn[256] = "";
int f_opt = 0, d_opt = 1;
@ -659,7 +663,10 @@ int main(int argc, char **argv)
if (d_opt)
rqlist = argv[2];
else
{
strcpy(fn, argv[2]);
rspfile = argv[3];
}
}
if (d_opt)
{ /* list of files (directory) */
@ -673,7 +680,7 @@ int main(int argc, char **argv)
strtok(fn, "\r\n");
strcpy(rfn, fn);
printf("Processing: %s\n", rfn);
if (proc_file(rfn))
if (proc_file(rfn, rspfile))
{
printf(">>> Processing failed for: %s <<<\n", rfn);
EXIT(1);
@ -685,7 +692,7 @@ int main(int argc, char **argv)
{
if (VERBOSE)
printf("Processing: %s\n", fn);
if (proc_file(fn))
if (proc_file(fn, rspfile))
{
printf(">>> Processing failed for: %s <<<\n", fn);
}

View File

@ -286,6 +286,7 @@ my $tprefix;
my $shwrap_prefix;
my $debug = 0;
my $quiet = 0;
my $rspdir = "rsp";
foreach (@ARGV)
{
@ -308,7 +309,10 @@ foreach (@ARGV)
elsif (/--dir=(.*)$/)
{
$tvdir = $1;
# $tvdir .= "/" unless $tvdir =~ /\/$/;
}
elsif (/--rspdir=(.*)$/)
{
$rspdir = $1;
}
elsif (/--tprefix=(.*)$/)
{
@ -433,7 +437,7 @@ sub test_dir
{
my ($win32, $req) = @_;
my $rsp = $req;
$rsp =~ s/req$/rsp/;
$rsp =~ s/req$/$rspdir/;
if ($win32)
{
$rsp =~ tr|/|\\|;
@ -460,17 +464,19 @@ END
sub test_line
{
my ($win32, $req, $tprefix, $tcmd) = @_;
my $rsp = $req;
$rsp =~ s/req\/([^\/]*).req$/$rspdir\/$1.rsp/;
if ($tcmd =~ /-f$/)
{
if ($win32)
{
$req =~ tr|/|\\|;
print OUT "$tprefix$tcmd \"$req\"\n";
print OUT "$tprefix$tcmd \"$req\" \"$rsp\"\n";
}
else
{
print OUT <<END;
${shwrap_prefix}shlib_wrap.sh $tprefix$tcmd "$req" || { echo "$req failure" ; exit 1
${shwrap_prefix}shlib_wrap.sh $tprefix$tcmd "$req" "$rsp" || { echo "$req failure" ; exit 1
}
END
}
@ -497,8 +503,6 @@ END
}
}
my $rsp = $req;
$rsp =~ s/req\/([^\/]*).req$/rsp\/$1.rsp/;
if ($win32)
{
$req =~ tr|/|\\|;