diff -ur -x *obj -x*pem -x*asm -x*def -x*mak -x *~ -x*conf* openssl-0.9.5/apps/speed.c openssl-0.9.5-fix/apps/speed.c
--- openssl-0.9.5/apps/speed.c	Fri Feb 11 01:46:56 2000
+++ openssl-0.9.5-fix/apps/speed.c	Fri Mar 10 14:44:26 2000
@@ -506,6 +506,7 @@
 			{
 			dsa_doit[R_DSA_512]=1;
 			dsa_doit[R_DSA_1024]=1;
+			dsa_doit[R_DSA_2048]=1;
 			}
 		else
 #endif
@@ -1035,6 +1036,26 @@
 		unsigned int kk;
 
 		if (!dsa_doit[j]) continue;
+
+		/* As this is a test we can get away with seeding the RNG with some
+		 *  crap ... however this may interfere with subsequent commands
+		 *  run from the OpenSSL> prompt ...
+		 */
+
+#if defined(WINDOWS)
+		RAND_screen();
+#elif defined(DEVRANDOM)
+		RAND_load_file(DEVRANDOM, 512);
+#else
+		/* 1024 bits of entropy should be enough to stop the PRNG error */
+		RAND_add((void *) dsa2048_g, sizeof(dsa2048_g), 1024);
+#endif
+		if (!DSA_generate_key(dsa_key[j]))
+		{
+			BIO_printf(bio_err, "DSA key generation failure\n");
+			ERR_print_errors(bio_err);
+			exit(-1);
+		}
 		DSA_generate_key(dsa_key[j]);
 /*		DSA_sign_setup(dsa_key[j],NULL); */
 		rsa_num=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,

diff -ur -x *obj -x*pem -x*asm -x*def -x*mak -x *~ -x*conf* openssl-0.9.5/crypto/dsa/dsa_key.c openssl-0.9.5-fix/crypto/dsa/dsa_key.c
--- openssl-0.9.5/crypto/dsa/dsa_key.c	Mon Apr 26 21:18:01 1999
+++ openssl-0.9.5-fix/crypto/dsa/dsa_key.c	Fri Mar 10 14:18:41 2000
@@ -84,7 +84,7 @@
 	i=BN_num_bits(dsa->q);
 	for (;;)
 		{
-		BN_rand(priv_key,i,1,0);
+		if (!BN_rand(priv_key,i,1,0)) goto err;
 		if (BN_cmp(priv_key,dsa->q) >= 0)
 			BN_sub(priv_key,priv_key,dsa->q);
 		if (!BN_is_zero(priv_key)) break;

diff -ur -x *obj -x*pem -x*asm -x*def -x*mak -x *~ -x*conf* openssl-0.9.5/crypto/rand/randfile.c openssl-0.9.5-fix/crypto/rand/randfile.c
--- openssl-0.9.5/crypto/rand/randfile.c	Fri Feb 25 17:55:56 2000
+++ openssl-0.9.5-fix/crypto/rand/randfile.c	Thu Mar 09 19:10:21 2000
@@ -154,10 +154,17 @@
 #if defined O_CREAT && defined O_EXCL
 		/* chmod(..., 0600) is too late to protect the file,
 		 * permissions should be restrictive from the start */
+
+		/* For some reason open() with O_CREAT | EXCL fails on Win98SE
+		 *  with MSVC 6.0sp3 */
 		int fd = open(file, O_CREAT | O_EXCL, 0600);
-		if (fd != -1)
+		if (fd != -1) {
 			out = fdopen(fd, "wb");
-#else		
+			}
+		else 
+			out = fopen(file, "wb");
+#else
 		out=fopen(file,"wb");
 #endif
 		}

