15fad7
diff -up openssl-1.0.0c/apps/genrsa.c.x931 openssl-1.0.0c/apps/genrsa.c
15fad7
--- openssl-1.0.0c/apps/genrsa.c.x931	2010-03-01 15:22:02.000000000 +0100
15fad7
+++ openssl-1.0.0c/apps/genrsa.c	2011-02-01 18:32:05.000000000 +0100
15fad7
@@ -95,6 +95,7 @@ int MAIN(int argc, char **argv)
15fad7
 	int ret=1;
15fad7
 	int i,num=DEFBITS;
15fad7
 	long l;
15fad7
+	int use_x931 = 0;
15fad7
 	const EVP_CIPHER *enc=NULL;
15fad7
 	unsigned long f4=RSA_F4;
15fad7
 	char *outfile=NULL;
15fad7
@@ -138,6 +139,8 @@ int MAIN(int argc, char **argv)
15fad7
 			f4=3;
15fad7
 		else if (strcmp(*argv,"-F4") == 0 || strcmp(*argv,"-f4") == 0)
15fad7
 			f4=RSA_F4;
15fad7
+		else if (strcmp(*argv,"-x931") == 0)
15fad7
+			use_x931 = 1;
15fad7
 #ifndef OPENSSL_NO_ENGINE
15fad7
 		else if (strcmp(*argv,"-engine") == 0)
15fad7
 			{
15fad7
@@ -273,7 +276,14 @@ bad:
15fad7
 	if (!rsa)
15fad7
 		goto err;
15fad7
 
15fad7
-	if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
15fad7
+	if (use_x931)
15fad7
+		{
15fad7
+		if (!BN_set_word(bn, f4))
15fad7
+			goto err;
15fad7
+		if (!RSA_X931_generate_key_ex(rsa, num, bn, &cb))
15fad7
+			goto err;
15fad7
+		}
15fad7
+	else if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
15fad7
 		goto err;
15fad7
 		
15fad7
 	app_RAND_write_file(NULL, bio_err);