summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2004-04-03 17:01:51 +0000
committerBen Laurie <ben@openssl.org>2004-04-03 17:01:51 +0000
commitdcd44b51213b91f606c0c56f63113413383051f5 (patch)
treedeb72c7929be7da9b7d62a7f6ddb4549fca789d5
parent75dca32a6cd0af99bfd9c27322f41c6e6ddeb3ce (diff)
New style PQGGen test.
-rw-r--r--fips/dsa/Makefile4
-rw-r--r--fips/dsa/fips_dssvs.c29
2 files changed, 20 insertions, 13 deletions
diff --git a/fips/dsa/Makefile b/fips/dsa/Makefile
index 7f7c81f7e0..8cd4b3ed13 100644
--- a/fips/dsa/Makefile
+++ b/fips/dsa/Makefile
@@ -79,8 +79,8 @@ A=../testvectors/dsa/rsp
fips_test: top_fips_dssvs
-rm -rf $A
mkdir $A
- ./fips_dssvs prime < $Q/prime.req > $A/prime.rsp
- ./fips_dssvs pqg < $Q/pqg.req > $A/pqg.rsp
+# ./fips_dssvs prime < $Q/prime.req > $A/prime.rsp
+ ./fips_dssvs pqg < $Q/PQGGen.req > $A/PQGGen.rsp
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
diff --git a/fips/dsa/fips_dssvs.c b/fips/dsa/fips_dssvs.c
index 052be67be9..a6c39560ad 100644
--- a/fips/dsa/fips_dssvs.c
+++ b/fips/dsa/fips_dssvs.c
@@ -67,7 +67,7 @@ void pv(char *tag,const unsigned char *val,int len)
int olen;
olen=bin2hex(val,len,obuf);
- printf("%s= %s\n", tag,obuf);
+ printf("%s = %s\n", tag,obuf);
}
void primes()
@@ -96,12 +96,13 @@ void pqg()
while(fgets(buf,sizeof buf,stdin) != NULL)
{
- fputs(buf,stdout);
- if(!strncmp(buf,"[mod=",5))
- nmod=atoi(buf+5);
- else if(!strncmp(buf,"N= ",3))
+ if(!strncmp(buf,"[mod = ",7))
+ nmod=atoi(buf+7);
+ else if(!strncmp(buf,"N = ",4))
{
- int n=atoi(buf+3);
+ int n=atoi(buf+4);
+
+ printf("[mod = %d]\n\n",nmod);
while(n--)
{
@@ -111,14 +112,18 @@ void pqg()
unsigned long h;
dsa=DSA_generate_parameters(nmod,seed,0,&counter,&h,NULL,NULL);
- printf("P= %s\n",BN_bn2hex(dsa->p));
- printf("Q= %s\n",BN_bn2hex(dsa->q));
- printf("G= %s\n",BN_bn2hex(dsa->g));
+ printf("P = %s\n",BN_bn2hex(dsa->p));
+ printf("Q = %s\n",BN_bn2hex(dsa->q));
+ printf("G = %s\n",BN_bn2hex(dsa->g));
pv("Seed",seed,20);
- printf("H= %lx\n",h);
- printf("C= %d\n",counter);
+ printf("c = %d\n",counter);
+ printf("H = %lx\n",h);
+ putc('\n',stdout);
}
}
+ else
+ fputs(buf,stdout);
+
}
}
@@ -139,6 +144,8 @@ int main(int argc,char **argv)
primes();
else if(!strcmp(argv[1],"pqg"))
pqg();
+ // else if(!strcmp(argv[1],"versig"))
+ // versig();
else
{
fprintf(stderr,"Don't know how to %s.\n",argv[1]);