[nginx] SSL: initialization changes for OpenSSL 1.1.0.
Maxim Dounin
mdounin at mdounin.ru
Thu Mar 31 23:57:38 UTC 2016
details: http://hg.nginx.org/nginx/rev/a57b2b8999e7
branches:
changeset: 6488:a57b2b8999e7
user: Maxim Dounin <mdounin at mdounin.ru>
date: Thu Mar 31 23:38:33 2016 +0300
description:
SSL: initialization changes for OpenSSL 1.1.0.
OPENSSL_config() deprecated in OpenSSL 1.1.0. Additionally,
SSL_library_init(), SSL_load_error_strings() and OpenSSL_add_all_algorithms()
are no longer available if OPENSSL_API_COMPAT is set to 0x10100000L.
The OPENSSL_init_ssl() function is now used instead with appropriate
arguments to trigger the same behaviour. The configure test changed to
use SSL_CTX_set_options().
Deinitialization now happens automatically in OPENSSL_cleanup() called
via atexit(3), so we no longer call EVP_cleanup() and ENGINE_cleanup()
directly.
diffstat:
auto/lib/openssl/conf | 2 +-
src/event/ngx_event_openssl.c | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletions(-)
diffs (50 lines):
diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
--- a/auto/lib/openssl/conf
+++ b/auto/lib/openssl/conf
@@ -52,7 +52,7 @@ else
ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_path=
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL"
- ngx_feature_test="SSL_library_init()"
+ ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
. auto/feature
if [ $ngx_found = no ]; then
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c
--- a/src/event/ngx_event_openssl.c
+++ b/src/event/ngx_event_openssl.c
@@ -111,6 +111,12 @@ int ngx_ssl_stapling_index;
ngx_int_t
ngx_ssl_init(ngx_log_t *log)
{
+#if OPENSSL_VERSION_NUMBER >= 0x10100003L
+
+ OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL);
+
+#else
+
#ifndef OPENSSL_IS_BORINGSSL
OPENSSL_config(NULL);
#endif
@@ -120,6 +126,8 @@ ngx_ssl_init(ngx_log_t *log)
OpenSSL_add_all_algorithms();
+#endif
+
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
#ifndef SSL_OP_NO_COMPRESSION
{
@@ -3548,8 +3556,12 @@ ngx_openssl_engine(ngx_conf_t *cf, ngx_c
static void
ngx_openssl_exit(ngx_cycle_t *cycle)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100003L
+
EVP_cleanup();
#ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup();
#endif
+
+#endif
}
More information about the nginx-devel
mailing list