From dcd44b51213b91f606c0c56f63113413383051f5 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sat, 3 Apr 2004 17:01:51 +0000 Subject: [PATCH] New style PQGGen test. --- fips/dsa/Makefile | 4 ++-- fips/dsa/fips_dssvs.c | 29 ++++++++++++++++++----------- 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]); -- 2.25.1