1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

Avoid use of deprecated RSA_generate_key() function.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1023521 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Henson
2010-10-17 16:30:13 +00:00
parent 962b1409a8
commit 25ff6f51f1
2 changed files with 24 additions and 1 deletions

View 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;
}

View File

@@ -48,6 +48,10 @@
#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