New style PQGGen test.
authorBen Laurie <ben@openssl.org>
Sat, 3 Apr 2004 17:01:51 +0000 (17:01 +0000)
committerBen Laurie <ben@openssl.org>
Sat, 3 Apr 2004 17:01:51 +0000 (17:01 +0000)
fips/dsa/Makefile
fips/dsa/fips_dssvs.c

index 7f7c81f7e0a7709718827fb2aa66c0f1bfbaed6a..8cd4b3ed1345d53fa0470bf68045c37dc7217c19 100644 (file)
@@ -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
index 052be67be9adf5a073064193f13877edf2a24218..a6c39560ad339081eed536a96998f280393fc6ef 100644 (file)
@@ -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]);