]> git.kaiwu.me - nginx.git/commitdiff
SSL: reasonable version for LibreSSL.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 31 Mar 2016 20:38:29 +0000 (23:38 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 31 Mar 2016 20:38:29 +0000 (23:38 +0300)
LibreSSL defines OPENSSL_VERSION_NUMBER to 0x20000000L, but uses an old
API derived from OpenSSL at the time LibreSSL forked.  As a result, every
version check we use to test for new API elements in newer OpenSSL versions
requires an explicit check for LibreSSL.

To reduce clutter, redefine OPENSSL_VERSION_NUMBER to 0x1000107fL if
LibreSSL is used.  The same is done by FreeBSD port of LibreSSL.

src/event/ngx_event_openssl.c
src/event/ngx_event_openssl.h

index 743928f78ab0f7a4dc8ff1e5ced1091bc907f993..7f435b473123b7b02b9b7aa5a9642d2ac0896687 100644 (file)
@@ -52,7 +52,7 @@ static int ngx_ssl_session_ticket_key_callback(ngx_ssl_conn_t *ssl_conn,
     HMAC_CTX *hctx, int enc);
 #endif
 
-#if (OPENSSL_VERSION_NUMBER < 0x10002002L || defined LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10002002L
 static ngx_int_t ngx_ssl_check_name(ngx_str_t *name, ASN1_STRING *str);
 #endif
 
@@ -2944,7 +2944,7 @@ ngx_ssl_check_host(ngx_connection_t *c, ngx_str_t *name)
         return NGX_ERROR;
     }
 
-#if (OPENSSL_VERSION_NUMBER >= 0x10002002L && !defined LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER >= 0x10002002L
 
     /* X509_check_host() is only available in OpenSSL 1.0.2+ */
 
@@ -3061,7 +3061,7 @@ found:
 }
 
 
-#if (OPENSSL_VERSION_NUMBER < 0x10002002L || defined LIBRESSL_VERSION_NUMBER)
+#if OPENSSL_VERSION_NUMBER < 0x10002002L
 
 static ngx_int_t
 ngx_ssl_check_name(ngx_str_t *name, ASN1_STRING *pattern)
index c86be2ac20632e05bfae677acdd74c896ed540c8..8ad87bbfae4d71e1b2f6d184eb806de1028a216d 100644 (file)
 #define NGX_SSL_NAME     "OpenSSL"
 
 
+#if (defined LIBRESSL_VERSION_NUMBER && OPENSSL_VERSION_NUMBER == 0x20000000L)
+#undef OPENSSL_VERSION_NUMBER
+#define OPENSSL_VERSION_NUMBER  0x1000107fL
+#endif
+
+
 #define ngx_ssl_session_t       SSL_SESSION
 #define ngx_ssl_conn_t          SSL