15fad7
diff -up openssl-1.0.0c/crypto/dsa/dsa_gen.c.fips186-3 openssl-1.0.0c/crypto/dsa/dsa_gen.c
15fad7
--- openssl-1.0.0c/crypto/dsa/dsa_gen.c.fips186-3	2011-02-03 21:04:14.000000000 +0100
15fad7
+++ openssl-1.0.0c/crypto/dsa/dsa_gen.c	2011-02-04 08:54:42.000000000 +0100
15fad7
@@ -120,11 +120,11 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 	int ok=0;
15fad7
 	unsigned char seed[SHA256_DIGEST_LENGTH];
15fad7
 	unsigned char md[SHA256_DIGEST_LENGTH];
15fad7
-	unsigned char buf[SHA256_DIGEST_LENGTH],buf2[SHA256_DIGEST_LENGTH];
15fad7
+	unsigned char buf[SHA256_DIGEST_LENGTH];
15fad7
 	BIGNUM *r0,*W,*X,*c,*test;
15fad7
 	BIGNUM *g=NULL,*q=NULL,*p=NULL;
15fad7
 	BN_MONT_CTX *mont=NULL;
15fad7
-	int i, k, n=0, m=0, qsize = qbits >> 3;
15fad7
+	int i, k, b, n=0, m=0, qsize = qbits >> 3;
15fad7
 	int counter=0;
15fad7
 	int r=0;
15fad7
 	BN_CTX *ctx=NULL;
15fad7
@@ -138,9 +138,13 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 	    goto err;
15fad7
 	    }
15fad7
 
15fad7
-	if (FIPS_mode() && (bits < OPENSSL_DSA_FIPS_MIN_MODULUS_BITS))
15fad7
+	if (FIPS_mode() &&
15fad7
+	    (bits != 1024 || qbits != 160) &&
15fad7
+	    (bits != 2048 || qbits != 224) &&
15fad7
+	    (bits != 2048 || qbits != 256) &&
15fad7
+	    (bits != 3072 || qbits != 256))
15fad7
 		{
15fad7
-		DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN, DSA_R_KEY_SIZE_TOO_SMALL);
15fad7
+		DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN, DSA_R_KEY_SIZE_INVALID);
15fad7
 		goto err;
15fad7
 		}
15fad7
 #endif
15fad7
@@ -151,22 +155,25 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 		return 0;
15fad7
 
15fad7
 	if (evpmd == NULL)
15fad7
-		/* use SHA1 as default */
15fad7
-		evpmd = EVP_sha1();
15fad7
+	    {
15fad7
+		if (qbits <= 160)
15fad7
+			evpmd = EVP_sha1();
15fad7
+		else if (qbits <= 224)
15fad7
+			evpmd = EVP_sha224();
15fad7
+		else
15fad7
+			evpmd = EVP_sha256();
15fad7
+	    }
15fad7
 
15fad7
 	if (bits < 512)
15fad7
 		bits = 512;
15fad7
 
15fad7
 	bits = (bits+63)/64*64;
15fad7
 
15fad7
-	/* NB: seed_len == 0 is special case: copy generated seed to
15fad7
- 	 * seed_in if it is not NULL.
15fad7
- 	 */
15fad7
 	if (seed_len && (seed_len < (size_t)qsize))
15fad7
 		seed_in = NULL;		/* seed buffer too small -- ignore */
15fad7
 	if (seed_len > (size_t)qsize) 
15fad7
 		seed_len = qsize;	/* App. 2.2 of FIPS PUB 186 allows larger SEED,
15fad7
-					 * but our internal buffers are restricted to 160 bits*/
15fad7
+					 * but our internal buffers are restricted to 256 bits*/
15fad7
 	if (seed_in != NULL)
15fad7
 		memcpy(seed, seed_in, seed_len);
15fad7
 
15fad7
@@ -189,13 +196,18 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 	if (!BN_lshift(test,BN_value_one(),bits-1))
15fad7
 		goto err;
15fad7
 
15fad7
+	/* step 3 n = \lceil bits / qbits \rceil - 1 */
15fad7
+	n = (bits+qbits-1)/qbits - 1;
15fad7
+	/* step 4 b = bits - 1 - n * qbits */
15fad7
+	b = bits - 1 - n*qbits;
15fad7
+
15fad7
 	for (;;)
15fad7
 		{
15fad7
 		for (;;) /* find q */
15fad7
 			{
15fad7
 			int seed_is_random;
15fad7
 
15fad7
-			/* step 1 */
15fad7
+			/* step 5 generate seed */
15fad7
 			if(!BN_GENCB_call(cb, 0, m++))
15fad7
 				goto err;
15fad7
 
15fad7
@@ -210,28 +222,17 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 				seed_len=0; /* use random seed if 'seed_in' turns out to be bad*/
15fad7
 				}
15fad7
 			memcpy(buf , seed, qsize);
15fad7
-			memcpy(buf2, seed, qsize);
15fad7
-			/* precompute "SEED + 1" for step 7: */
15fad7
-			for (i = qsize-1; i >= 0; i--)
15fad7
-				{
15fad7
-				buf[i]++;
15fad7
-				if (buf[i] != 0)
15fad7
-					break;
15fad7
-				}
15fad7
 
15fad7
-			/* step 2 */
15fad7
+			/* step 6 U = hash(seed) */
15fad7
 			EVP_Digest(seed, qsize, md,   NULL, evpmd, NULL);
15fad7
-			EVP_Digest(buf,  qsize, buf2, NULL, evpmd, NULL);
15fad7
-			for (i = 0; i < qsize; i++)
15fad7
-				md[i]^=buf2[i];
15fad7
 
15fad7
-			/* step 3 */
15fad7
+			/* step 7 q = 2^(qbits-1) + U + 1 - (U mod 2) */
15fad7
 			md[0] |= 0x80;
15fad7
 			md[qsize-1] |= 0x01;
15fad7
 			if (!BN_bin2bn(md, qsize, q))
15fad7
 				goto err;
15fad7
 
15fad7
-			/* step 4 */
15fad7
+			/* step 8 test for prime (64 round of Rabin-Miller) */
15fad7
 			r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx,
15fad7
 					seed_is_random, cb);
15fad7
 			if (r > 0)
15fad7
@@ -239,27 +240,22 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 			if (r != 0)
15fad7
 				goto err;
15fad7
 
15fad7
-			/* do a callback call */
15fad7
-			/* step 5 */
15fad7
 			}
15fad7
 
15fad7
 		if(!BN_GENCB_call(cb, 2, 0)) goto err;
15fad7
 		if(!BN_GENCB_call(cb, 3, 0)) goto err;
15fad7
 
15fad7
-		/* step 6 */
15fad7
+		/* step 11 */
15fad7
 		counter=0;
15fad7
-		/* "offset = 2" */
15fad7
-
15fad7
-		n=(bits-1)/160;
15fad7
+		/* "offset = 1" */
15fad7
 
15fad7
 		for (;;)
15fad7
 			{
15fad7
 			if ((counter != 0) && !BN_GENCB_call(cb, 0, counter))
15fad7
 				goto err;
15fad7
 
15fad7
-			/* step 7 */
15fad7
+			/* step 11.1, 11.2 obtain W */
15fad7
 			BN_zero(W);
15fad7
-			/* now 'buf' contains "SEED + offset - 1" */
15fad7
 			for (k=0; k<=n; k++)
15fad7
 				{
15fad7
 				/* obtain "SEED + offset + k" by incrementing: */
15fad7
@@ -272,28 +268,30 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 
15fad7
 				EVP_Digest(buf, qsize, md ,NULL, evpmd, NULL);
15fad7
 
15fad7
-				/* step 8 */
15fad7
 				if (!BN_bin2bn(md, qsize, r0))
15fad7
 					goto err;
15fad7
-				if (!BN_lshift(r0,r0,(qsize << 3)*k)) goto err;
15fad7
+				if (k == n)
15fad7
+					BN_mask_bits(r0,b);
15fad7
+				if (!BN_lshift(r0,r0,qbits*k)) goto err;
15fad7
 				if (!BN_add(W,W,r0)) goto err;
15fad7
 				}
15fad7
 
15fad7
-			/* more of step 8 */
15fad7
-			if (!BN_mask_bits(W,bits-1)) goto err;
15fad7
+			/* step 11.3 X = W + 2^(L-1) */
15fad7
 			if (!BN_copy(X,W)) goto err;
15fad7
 			if (!BN_add(X,X,test)) goto err;
15fad7
 
15fad7
-			/* step 9 */
15fad7
+			/* step 11.4 c = X mod 2*q */
15fad7
 			if (!BN_lshift1(r0,q)) goto err;
15fad7
 			if (!BN_mod(c,X,r0,ctx)) goto err;
15fad7
+
15fad7
+			/* step 11.5 p = X - (c - 1) */
15fad7
 			if (!BN_sub(r0,c,BN_value_one())) goto err;
15fad7
 			if (!BN_sub(p,X,r0)) goto err;
15fad7
 
15fad7
-			/* step 10 */
15fad7
+			/* step 11.6 */
15fad7
 			if (BN_cmp(p,test) >= 0)
15fad7
 				{
15fad7
-				/* step 11 */
15fad7
+				/* step 11.7 */
15fad7
 				r = BN_is_prime_fasttest_ex(p, DSS_prime_checks,
15fad7
 						ctx, 1, cb);
15fad7
 				if (r > 0)
15fad7
@@ -302,12 +300,12 @@ int dsa_builtin_paramgen(DSA *ret, size_
15fad7
 					goto err;
15fad7
 				}
15fad7
 
15fad7
-			/* step 13 */
15fad7
+			/* step 11.9 */
15fad7
 			counter++;
15fad7
 			/* "offset = offset + n + 1" */
15fad7
 
15fad7
-			/* step 14 */
15fad7
-			if (counter >= 4096) break;
15fad7
+			/* step 12 */
15fad7
+			if (counter >= 4*bits) break;
15fad7
 			}
15fad7
 		}
15fad7
 end:
15fad7
diff -up openssl-1.0.0c/crypto/dsa/dsa.h.fips186-3 openssl-1.0.0c/crypto/dsa/dsa.h
15fad7
--- openssl-1.0.0c/crypto/dsa/dsa.h.fips186-3	2011-02-03 21:04:14.000000000 +0100
15fad7
+++ openssl-1.0.0c/crypto/dsa/dsa.h	2011-02-03 21:04:14.000000000 +0100
15fad7
@@ -316,6 +316,7 @@ void ERR_load_DSA_strings(void);
15fad7
 #define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE		 100
15fad7
 #define DSA_R_DECODE_ERROR				 104
15fad7
 #define DSA_R_INVALID_DIGEST_TYPE			 106
15fad7
+#define DSA_R_KEY_SIZE_INVALID				 113
15fad7
 #define DSA_R_KEY_SIZE_TOO_SMALL			 110
15fad7
 #define DSA_R_MISSING_PARAMETERS			 101
15fad7
 #define DSA_R_MODULUS_TOO_LARGE				 103
15fad7
diff -up openssl-1.0.0c/crypto/dsa/dsatest.c.fips186-3 openssl-1.0.0c/crypto/dsa/dsatest.c
15fad7
--- openssl-1.0.0c/crypto/dsa/dsatest.c.fips186-3	2011-02-03 21:14:07.000000000 +0100
15fad7
+++ openssl-1.0.0c/crypto/dsa/dsatest.c	2011-02-04 08:40:24.000000000 +0100
15fad7
@@ -96,36 +96,41 @@ static int MS_CALLBACK dsa_cb(int p, int
15fad7
 /* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to
15fad7
  * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */
15fad7
 static unsigned char seed[20]={
15fad7
-	0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40,
15fad7
-	0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3,
15fad7
+	0x02,0x47,0x11,0x92,0x11,0x88,0xC8,0xFB,0xAF,0x48,0x4C,0x62,
15fad7
+	0xDF,0xA5,0xBE,0xA0,0xA4,0x3C,0x56,0xE3,
15fad7
 	};
15fad7
 
15fad7
 static unsigned char out_p[]={
15fad7
-	0x8d,0xf2,0xa4,0x94,0x49,0x22,0x76,0xaa,
15fad7
-	0x3d,0x25,0x75,0x9b,0xb0,0x68,0x69,0xcb,
15fad7
-	0xea,0xc0,0xd8,0x3a,0xfb,0x8d,0x0c,0xf7,
15fad7
-	0xcb,0xb8,0x32,0x4f,0x0d,0x78,0x82,0xe5,
15fad7
-	0xd0,0x76,0x2f,0xc5,0xb7,0x21,0x0e,0xaf,
15fad7
-	0xc2,0xe9,0xad,0xac,0x32,0xab,0x7a,0xac,
15fad7
-	0x49,0x69,0x3d,0xfb,0xf8,0x37,0x24,0xc2,
15fad7
-	0xec,0x07,0x36,0xee,0x31,0xc8,0x02,0x91,
15fad7
+	0xAC,0xCB,0x1E,0x63,0x60,0x69,0x0C,0xFB,0x06,0x19,0x68,0x3E,
15fad7
+	0xA5,0x01,0x5A,0xA2,0x15,0x5C,0xE2,0x99,0x2D,0xD5,0x30,0x99,
15fad7
+	0x7E,0x5F,0x8D,0xE2,0xF7,0xC6,0x2E,0x8D,0xA3,0x9F,0x58,0xAD,
15fad7
+	0xD6,0xA9,0x7D,0x0E,0x0D,0x95,0x53,0xA6,0x71,0x3A,0xDE,0xAB,
15fad7
+	0xAC,0xE9,0xF4,0x36,0x55,0x9E,0xB9,0xD6,0x93,0xBF,0xF3,0x18,
15fad7
+	0x1C,0x14,0x7B,0xA5,0x42,0x2E,0xCD,0x00,0xEB,0x35,0x3B,0x1B,
15fad7
+	0xA8,0x51,0xBB,0xE1,0x58,0x42,0x85,0x84,0x22,0xA7,0x97,0x5E,
15fad7
+	0x99,0x6F,0x38,0x20,0xBD,0x9D,0xB6,0xD9,0x33,0x37,0x2A,0xFD,
15fad7
+	0xBB,0xD4,0xBC,0x0C,0x2A,0x67,0xCB,0x9F,0xBB,0xDF,0xF9,0x93,
15fad7
+	0xAA,0xD6,0xF0,0xD6,0x95,0x0B,0x5D,0x65,0x14,0xD0,0x18,0x9D,
15fad7
+	0xC6,0xAF,0xF0,0xC6,0x37,0x7C,0xF3,0x5F,
15fad7
 	};
15fad7
 
15fad7
 static unsigned char out_q[]={
15fad7
-	0xc7,0x73,0x21,0x8c,0x73,0x7e,0xc8,0xee,
15fad7
-	0x99,0x3b,0x4f,0x2d,0xed,0x30,0xf4,0x8e,
15fad7
-	0xda,0xce,0x91,0x5f,
15fad7
+	0xE3,0x8E,0x5E,0x6D,0xBF,0x2B,0x79,0xF8,0xC5,0x4B,0x89,0x8B,
15fad7
+	0xBA,0x2D,0x91,0xC3,0x6C,0x80,0xAC,0x87,
15fad7
 	};
15fad7
 
15fad7
 static unsigned char out_g[]={
15fad7
-	0x62,0x6d,0x02,0x78,0x39,0xea,0x0a,0x13,
15fad7
-	0x41,0x31,0x63,0xa5,0x5b,0x4c,0xb5,0x00,
15fad7
-	0x29,0x9d,0x55,0x22,0x95,0x6c,0xef,0xcb,
15fad7
-	0x3b,0xff,0x10,0xf3,0x99,0xce,0x2c,0x2e,
15fad7
-	0x71,0xcb,0x9d,0xe5,0xfa,0x24,0xba,0xbf,
15fad7
-	0x58,0xe5,0xb7,0x95,0x21,0x92,0x5c,0x9c,
15fad7
-	0xc4,0x2e,0x9f,0x6f,0x46,0x4b,0x08,0x8c,
15fad7
-	0xc5,0x72,0xaf,0x53,0xe6,0xd7,0x88,0x02,
15fad7
+	0x42,0x4A,0x04,0x4E,0x79,0xB4,0x99,0x7F,0xFD,0x58,0x36,0x2C,
15fad7
+	0x1B,0x5F,0x18,0x7E,0x0D,0xCC,0xAB,0x81,0xC9,0x5D,0x10,0xCE,
15fad7
+	0x4E,0x80,0x7E,0x58,0xB4,0x34,0x3F,0xA7,0x45,0xC7,0xAA,0x36,
15fad7
+	0x24,0x42,0xA9,0x3B,0xE8,0x0E,0x04,0x02,0x2D,0xFB,0xA6,0x13,
15fad7
+	0xB9,0xB5,0x15,0xA5,0x56,0x07,0x35,0xE4,0x03,0xB6,0x79,0x7C,
15fad7
+	0x62,0xDD,0xDF,0x3F,0x71,0x3A,0x9D,0x8B,0xC4,0xF6,0xE7,0x1D,
15fad7
+	0x52,0xA8,0xA9,0x43,0x1D,0x33,0x51,0x88,0x39,0xBD,0x73,0xE9,
15fad7
+	0x5F,0xBE,0x82,0x49,0x27,0xE6,0xB5,0x53,0xC1,0x38,0xAC,0x2F,
15fad7
+	0x6D,0x97,0x6C,0xEB,0x67,0xC1,0x5F,0x67,0xF8,0x35,0x05,0x5E,
15fad7
+	0xD5,0x68,0x80,0xAA,0x96,0xCA,0x0B,0x8A,0xE6,0xF1,0xB1,0x41,
15fad7
+	0xC6,0x75,0x94,0x0A,0x0A,0x2A,0xFA,0x29,
15fad7
 	};
15fad7
 
15fad7
 static const unsigned char str1[]="12345678901234567890";
15fad7
@@ -157,7 +162,7 @@ int main(int argc, char **argv)
15fad7
 	BIO_printf(bio_err,"test generation of DSA parameters\n");
15fad7
 
15fad7
 	BN_GENCB_set(&cb, dsa_cb, bio_err);
15fad7
-	if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 512,
15fad7
+	if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 1024,
15fad7
 				seed, 20, &counter, &h, &cb))
15fad7
 		goto end;
15fad7
 
15fad7
@@ -170,9 +175,9 @@ int main(int argc, char **argv)
15fad7
 	BIO_printf(bio_err,"\ncounter=%d h=%ld\n",counter,h);
15fad7
 		
15fad7
 	DSA_print(bio_err,dsa,0);
15fad7
-	if (counter != 105) 
15fad7
+	if (counter != 239) 
15fad7
 		{
15fad7
-		BIO_printf(bio_err,"counter should be 105\n");
15fad7
+		BIO_printf(bio_err,"counter should be 239\n");
15fad7
 		goto end;
15fad7
 		}
15fad7
 	if (h != 2)
15fad7
diff -up openssl-1.0.0c/crypto/fips/fips_dsa_selftest.c.fips186-3 openssl-1.0.0c/crypto/fips/fips_dsa_selftest.c
15fad7
--- openssl-1.0.0c/crypto/fips/fips_dsa_selftest.c.fips186-3	2011-02-03 21:04:14.000000000 +0100
15fad7
+++ openssl-1.0.0c/crypto/fips/fips_dsa_selftest.c	2011-02-04 09:03:03.000000000 +0100
15fad7
@@ -68,44 +68,42 @@
15fad7
 
15fad7
 #ifdef OPENSSL_FIPS
15fad7
 
15fad7
-/* seed, out_p, out_q, out_g are taken the NIST test vectors */
15fad7
-
15fad7
 static unsigned char seed[20] = {
15fad7
-	0x77, 0x8f, 0x40, 0x74, 0x6f, 0x66, 0xbe, 0x33, 0xce, 0xbe, 0x99, 0x34,
15fad7
-	0x4c, 0xfc, 0xf3, 0x28, 0xaa, 0x70, 0x2d, 0x3a
15fad7
-  	};
15fad7
+	0x02,0x47,0x11,0x92,0x11,0x88,0xC8,0xFB,0xAF,0x48,0x4C,0x62,
15fad7
+	0xDF,0xA5,0xBE,0xA0,0xA4,0x3C,0x56,0xE3,
15fad7
+	};
15fad7
 
15fad7
 static unsigned char out_p[] = {
15fad7
-	0xf7, 0x7c, 0x1b, 0x83, 0xd8, 0xe8, 0x5c, 0x7f, 0x85, 0x30, 0x17, 0x57,
15fad7
-	0x21, 0x95, 0xfe, 0x26, 0x04, 0xeb, 0x47, 0x4c, 0x3a, 0x4a, 0x81, 0x4b,
15fad7
-	0x71, 0x2e, 0xed, 0x6e, 0x4f, 0x3d, 0x11, 0x0f, 0x7c, 0xfe, 0x36, 0x43,
15fad7
-	0x51, 0xd9, 0x81, 0x39, 0x17, 0xdf, 0x62, 0xf6, 0x9c, 0x01, 0xa8, 0x69,
15fad7
-	0x71, 0xdd, 0x29, 0x7f, 0x47, 0xe6, 0x65, 0xa6, 0x22, 0xe8, 0x6a, 0x12,
15fad7
-	0x2b, 0xc2, 0x81, 0xff, 0x32, 0x70, 0x2f, 0x9e, 0xca, 0x53, 0x26, 0x47,
15fad7
-	0x0f, 0x59, 0xd7, 0x9e, 0x2c, 0xa5, 0x07, 0xc4, 0x49, 0x52, 0xa3, 0xe4,
15fad7
-	0x6b, 0x04, 0x00, 0x25, 0x49, 0xe2, 0xe6, 0x7f, 0x28, 0x78, 0x97, 0xb8,
15fad7
-	0x3a, 0x32, 0x14, 0x38, 0xa2, 0x51, 0x33, 0x22, 0x44, 0x7e, 0xd7, 0xef,
15fad7
-	0x45, 0xdb, 0x06, 0x4a, 0xd2, 0x82, 0x4a, 0x82, 0x2c, 0xb1, 0xd7, 0xd8,
15fad7
-	0xb6, 0x73, 0x00, 0x4d, 0x94, 0x77, 0x94, 0xef
15fad7
+	0xAC,0xCB,0x1E,0x63,0x60,0x69,0x0C,0xFB,0x06,0x19,0x68,0x3E,
15fad7
+	0xA5,0x01,0x5A,0xA2,0x15,0x5C,0xE2,0x99,0x2D,0xD5,0x30,0x99,
15fad7
+	0x7E,0x5F,0x8D,0xE2,0xF7,0xC6,0x2E,0x8D,0xA3,0x9F,0x58,0xAD,
15fad7
+	0xD6,0xA9,0x7D,0x0E,0x0D,0x95,0x53,0xA6,0x71,0x3A,0xDE,0xAB,
15fad7
+	0xAC,0xE9,0xF4,0x36,0x55,0x9E,0xB9,0xD6,0x93,0xBF,0xF3,0x18,
15fad7
+	0x1C,0x14,0x7B,0xA5,0x42,0x2E,0xCD,0x00,0xEB,0x35,0x3B,0x1B,
15fad7
+	0xA8,0x51,0xBB,0xE1,0x58,0x42,0x85,0x84,0x22,0xA7,0x97,0x5E,
15fad7
+	0x99,0x6F,0x38,0x20,0xBD,0x9D,0xB6,0xD9,0x33,0x37,0x2A,0xFD,
15fad7
+	0xBB,0xD4,0xBC,0x0C,0x2A,0x67,0xCB,0x9F,0xBB,0xDF,0xF9,0x93,
15fad7
+	0xAA,0xD6,0xF0,0xD6,0x95,0x0B,0x5D,0x65,0x14,0xD0,0x18,0x9D,
15fad7
+	0xC6,0xAF,0xF0,0xC6,0x37,0x7C,0xF3,0x5F,
15fad7
 	};
15fad7
 
15fad7
 static unsigned char out_q[] = {
15fad7
-	0xd4, 0x0a, 0xac, 0x9f, 0xbd, 0x8c, 0x80, 0xc2, 0x38, 0x7e, 0x2e, 0x0c,
15fad7
-	0x52, 0x5c, 0xea, 0x34, 0xa1, 0x83, 0x32, 0xf3
15fad7
+	0xE3,0x8E,0x5E,0x6D,0xBF,0x2B,0x79,0xF8,0xC5,0x4B,0x89,0x8B,
15fad7
+	0xBA,0x2D,0x91,0xC3,0x6C,0x80,0xAC,0x87,
15fad7
 	};
15fad7
 
15fad7
 static unsigned char out_g[] = {
15fad7
-	0x34, 0x73, 0x8b, 0x57, 0x84, 0x8e, 0x55, 0xbf, 0x57, 0xcc, 0x41, 0xbb,
15fad7
-	0x5e, 0x2b, 0xd5, 0x42, 0xdd, 0x24, 0x22, 0x2a, 0x09, 0xea, 0x26, 0x1e,
15fad7
-	0x17, 0x65, 0xcb, 0x1a, 0xb3, 0x12, 0x44, 0xa3, 0x9e, 0x99, 0xe9, 0x63,
15fad7
-	0xeb, 0x30, 0xb1, 0x78, 0x7b, 0x09, 0x40, 0x30, 0xfa, 0x83, 0xc2, 0x35,
15fad7
-	0xe1, 0xc4, 0x2d, 0x74, 0x1a, 0xb1, 0x83, 0x54, 0xd8, 0x29, 0xf4, 0xcf,
15fad7
-	0x7f, 0x6f, 0x67, 0x1c, 0x36, 0x49, 0xee, 0x6c, 0xa2, 0x3c, 0x2d, 0x6a,
15fad7
-	0xe9, 0xd3, 0x9a, 0xf6, 0x57, 0x78, 0x6f, 0xfd, 0x33, 0xcd, 0x3c, 0xed,
15fad7
-	0xfd, 0xd4, 0x41, 0xe6, 0x5c, 0x8b, 0xe0, 0x68, 0x31, 0x47, 0x47, 0xaf,
15fad7
-	0x12, 0xa7, 0xf9, 0x32, 0x0d, 0x94, 0x15, 0x48, 0xd0, 0x54, 0x85, 0xb2,
15fad7
-	0x04, 0xb5, 0x4d, 0xd4, 0x9d, 0x05, 0x22, 0x25, 0xd9, 0xfd, 0x6c, 0x36,
15fad7
-	0xef, 0xbe, 0x69, 0x6c, 0x55, 0xf4, 0xee, 0xec
15fad7
+	0x42,0x4A,0x04,0x4E,0x79,0xB4,0x99,0x7F,0xFD,0x58,0x36,0x2C,
15fad7
+	0x1B,0x5F,0x18,0x7E,0x0D,0xCC,0xAB,0x81,0xC9,0x5D,0x10,0xCE,
15fad7
+	0x4E,0x80,0x7E,0x58,0xB4,0x34,0x3F,0xA7,0x45,0xC7,0xAA,0x36,
15fad7
+	0x24,0x42,0xA9,0x3B,0xE8,0x0E,0x04,0x02,0x2D,0xFB,0xA6,0x13,
15fad7
+	0xB9,0xB5,0x15,0xA5,0x56,0x07,0x35,0xE4,0x03,0xB6,0x79,0x7C,
15fad7
+	0x62,0xDD,0xDF,0x3F,0x71,0x3A,0x9D,0x8B,0xC4,0xF6,0xE7,0x1D,
15fad7
+	0x52,0xA8,0xA9,0x43,0x1D,0x33,0x51,0x88,0x39,0xBD,0x73,0xE9,
15fad7
+	0x5F,0xBE,0x82,0x49,0x27,0xE6,0xB5,0x53,0xC1,0x38,0xAC,0x2F,
15fad7
+	0x6D,0x97,0x6C,0xEB,0x67,0xC1,0x5F,0x67,0xF8,0x35,0x05,0x5E,
15fad7
+	0xD5,0x68,0x80,0xAA,0x96,0xCA,0x0B,0x8A,0xE6,0xF1,0xB1,0x41,
15fad7
+	0xC6,0x75,0x94,0x0A,0x0A,0x2A,0xFA,0x29,
15fad7
 	};
15fad7
 
15fad7
 static const unsigned char str1[]="12345678901234567890";
15fad7
@@ -133,7 +131,7 @@ int FIPS_selftest_dsa()
15fad7
 	goto err;
15fad7
     if(!DSA_generate_parameters_ex(dsa, 1024,seed,20,&counter,&h,NULL))
15fad7
 	goto err;
15fad7
-    if (counter != 378) 
15fad7
+    if (counter != 239) 
15fad7
 	goto err;
15fad7
     if (h != 2)
15fad7
 	goto err;