[nginx] SSL: SSLeay_version() is deprecated in OpenSSL 1.1.0.

Maxim Dounin mdounin at mdounin.ru
Thu Mar 31 23:57:48 UTC 2016


details:   http://hg.nginx.org/nginx/rev/3b77efe05b92
branches:  
changeset: 6492:3b77efe05b92
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Thu Mar 31 23:38:38 2016 +0300
description:
SSL: SSLeay_version() is deprecated in OpenSSL 1.1.0.

SSLeay_version() and SSLeay() are no longer available if OPENSSL_API_COMPAT
is set to 0x10100000L.  Switched to using OpenSSL_version() instead.

Additionally, we now compare version strings instead of version numbers,
and this correctly works for LibreSSL as well.

diffstat:

 src/core/nginx.c              |   5 ++---
 src/event/ngx_event_openssl.h |  11 +++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (40 lines):

diff --git a/src/core/nginx.c b/src/core/nginx.c
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -413,13 +413,12 @@ ngx_show_version_info(void)
 #endif
 
 #if (NGX_SSL)
-        if (SSLeay() == SSLEAY_VERSION_NUMBER) {
+        if (ngx_strcmp(ngx_ssl_version(), OPENSSL_VERSION_TEXT) == 0) {
             ngx_write_stderr("built with " OPENSSL_VERSION_TEXT NGX_LINEFEED);
         } else {
             ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
                              " (running with ");
-            ngx_write_stderr((char *) (uintptr_t)
-                             SSLeay_version(SSLEAY_VERSION));
+            ngx_write_stderr((char *) (uintptr_t) ngx_ssl_version());
             ngx_write_stderr(")" NGX_LINEFEED);
         }
 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
diff --git a/src/event/ngx_event_openssl.h b/src/event/ngx_event_openssl.h
--- a/src/event/ngx_event_openssl.h
+++ b/src/event/ngx_event_openssl.h
@@ -39,6 +39,17 @@
 #endif
 
 
+#if (OPENSSL_VERSION_NUMBER >= 0x10100001L)
+
+#define ngx_ssl_version()       OpenSSL_version(OPENSSL_VERSION)
+
+#else
+
+#define ngx_ssl_version()       SSLeay_version(SSLEAY_VERSION)
+
+#endif
+
+
 #define ngx_ssl_session_t       SSL_SESSION
 #define ngx_ssl_conn_t          SSL
 



More information about the nginx-devel mailing list