]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Avoid use of deprecated RSA_generate_key() function.
authorStephen Henson <drh@apache.org>
Sun, 17 Oct 2010 16:30:13 +0000 (16:30 +0000)
committerStephen Henson <drh@apache.org>
Sun, 17 Oct 2010 16:30:13 +0000 (16:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023521 13f79535-47bb-0310-9956-ffa450edef68

modules/ssl/ssl_engine_init.c
modules/ssl/ssl_toolkit_compat.h

index a2ba9a13315a87d40b1c108104ae9608471f068d..1bffc1ae666f4d9c2d65946a46dd159179850749 100644 (file)
@@ -90,7 +90,25 @@ static int ssl_tmp_key_init_rsa(server_rec *s,
     }
 
 #endif
-
+#ifdef HAVE_GENERATE_EX
+    {
+        RSA *tkey;
+        BIGNUM *bn_f4;
+        if (!(tkey == RSA_new())
+          || !(bn_f4 == BN_new())
+          || !BN_set_word(bn_f4, RSA_F4)
+          || !RSA_generate_key_ex(tkey, bits, bn_f4, NULL))
+        {
+            ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+                         "Init: Failed to generate temporary "
+                         "%d bit RSA private key", bits);
+            ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
+            return !OK;
+        }
+        BN_free(bn_f4);
+        mc->pTmpKeys[idx] = tkey;
+    }
+#else
     if (!(mc->pTmpKeys[idx] =
           RSA_generate_key(bits, RSA_F4, NULL, NULL)))
     {
@@ -100,6 +118,7 @@ static int ssl_tmp_key_init_rsa(server_rec *s,
         ssl_log_ssl_error(SSLLOG_MARK, APLOG_ERR, s);
         return !OK;
     }
+#endif
 
     return OK;
 }
index e87361b7ff505378deffafa162eae2100827589e..b041ee82528cdfca96ba3f2a009ba74f34f5fa91 100644 (file)
 #include <openssl/ocsp.h>
 #endif
 
+#if (OPENSSL_VERSION_NUMBER >= 0x00908000)
+#define HAVE_GENERATE_EX
+#endif
+
 /* ECC support came along in OpenSSL 1.0.0 */
 #if (OPENSSL_VERSION_NUMBER < 0x10000000)
 #define OPENSSL_NO_EC