Blame SOURCES/openssl-1.0.1e-req-keylen.patch

2b5643
diff -up openssl-1.0.1e/apps/req.c.keylen openssl-1.0.1e/apps/req.c
2b5643
--- openssl-1.0.1e/apps/req.c.keylen	2014-02-12 14:58:29.000000000 +0100
2b5643
+++ openssl-1.0.1e/apps/req.c	2014-02-14 13:52:48.692325000 +0100
2b5643
@@ -644,6 +644,12 @@ bad:
2b5643
 		if (inrand)
2b5643
 			app_RAND_load_files(inrand);
2b5643
 
2b5643
+		if (newkey <= 0)
2b5643
+			{
2b5643
+			if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
2b5643
+				newkey=DEFAULT_KEY_LENGTH;
2b5643
+			}
2b5643
+
2b5643
 		if (keyalg)
2b5643
 			{
2b5643
 			genctx = set_keygen_ctx(bio_err, keyalg, &pkey_type, &newkey,
2b5643
@@ -651,12 +657,6 @@ bad:
2b5643
 			if (!genctx)
2b5643
 				goto end;
2b5643
 			}
2b5643
-	
2b5643
-		if (newkey <= 0)
2b5643
-			{
2b5643
-			if (!NCONF_get_number(req_conf,SECTION,BITS, &newkey))
2b5643
-				newkey=DEFAULT_KEY_LENGTH;
2b5643
-			}
2b5643
 
2b5643
 		if (newkey < MIN_KEY_LENGTH && (pkey_type == EVP_PKEY_RSA || pkey_type == EVP_PKEY_DSA))
2b5643
 			{
2b5643
@@ -1649,6 +1649,8 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO
2b5643
 				keylen = atol(p + 1);
2b5643
 				*pkeylen = keylen;
2b5643
 				}
2b5643
+			else
2b5643
+				keylen = *pkeylen;
2b5643
 			}
2b5643
 		else if (p)
2b5643
 			paramfile = p + 1;