55#ifndef DDEBUG
66#define DDEBUG 0
77#endif
8- #include "ddebug.h"
9-
108
11- #if (NGX_STREAM_SSL )
9+ #include "ddebug.h"
10+ #include "ngx_stream_lua_proxy_ssl_certby.h"
1211
12+ #ifdef HAVE_LUA_PROXY_SSL
1313#include "ngx_stream_lua_cache.h"
1414#include "ngx_stream_lua_initworkerby.h"
1515#include "ngx_stream_lua_util.h"
1818#include "ngx_stream_lua_directive.h"
1919#include "ngx_stream_lua_ssl.h"
2020
21- #ifdef HAVE_PROXY_SSL_PATCH
22- #include "ngx_stream_lua_proxy_ssl_certby.h"
23-
2421
2522static void ngx_stream_lua_proxy_ssl_cert_done (void * data );
2623static void ngx_stream_lua_proxy_ssl_cert_aborted (void * data );
@@ -31,16 +28,6 @@ static ngx_int_t ngx_stream_lua_proxy_ssl_cert_by_chunk(lua_State *L,
3128ngx_int_t
3229ngx_stream_lua_proxy_ssl_cert_set_callback (ngx_conf_t * cf )
3330{
34-
35- #ifdef LIBRESSL_VERSION_NUMBER
36-
37- ngx_log_error (NGX_LOG_EMERG , cf -> log , 0 ,
38- "LibreSSL does not support by proxy_ssl_certificate_by_lua*" );
39-
40- return NGX_ERROR ;
41-
42- #else
43-
4431 ngx_flag_t proxy_ssl = 0 ;
4532 ngx_pool_cleanup_t * cln ;
4633 ngx_ssl_t * ssl ;
@@ -76,22 +63,9 @@ ngx_stream_lua_proxy_ssl_cert_set_callback(ngx_conf_t *cf)
7663 return NGX_ERROR ;
7764 }
7865
79- #if OPENSSL_VERSION_NUMBER >= 0x1000205fL
80-
8166 SSL_CTX_set_cert_cb (ssl -> ctx , ngx_stream_lua_proxy_ssl_cert_handler , NULL );
8267
8368 return NGX_OK ;
84-
85- #else
86-
87- ngx_log_error (NGX_LOG_EMERG , cf -> log , 0 , "OpenSSL too old to support "
88- "proxy_ssl_certificate_by_lua*" );
89-
90- return NGX_ERROR ;
91-
92- #endif
93-
94- #endif
9569}
9670
9771
@@ -160,16 +134,6 @@ char *
160134ngx_stream_lua_proxy_ssl_cert_by_lua (ngx_conf_t * cf , ngx_command_t * cmd ,
161135 void * conf )
162136{
163- #if OPENSSL_VERSION_NUMBER < 0x1000205fL
164-
165- ngx_log_error (NGX_LOG_EMERG , cf -> log , 0 ,
166- "at least OpenSSL 1.0.2e required but found "
167- OPENSSL_VERSION_TEXT );
168-
169- return NGX_CONF_ERROR ;
170-
171- #else
172-
173137 u_char * p ;
174138 u_char * name ;
175139 ngx_str_t * value ;
@@ -239,8 +203,6 @@ ngx_stream_lua_proxy_ssl_cert_by_lua(ngx_conf_t *cf, ngx_command_t *cmd,
239203 }
240204
241205 return NGX_CONF_OK ;
242-
243- #endif /* OPENSSL_VERSION_NUMBER < 0x1000205fL */
244206}
245207
246208
582544ngx_stream_lua_ffi_proxy_ssl_clear_certs (ngx_stream_lua_request_t * r ,
583545 char * * err )
584546{
585- #ifdef LIBRESSL_VERSION_NUMBER
586-
587- * err = "LibreSSL not supported" ;
588- return NGX_ERROR ;
589-
590- #else
591-
592- # if OPENSSL_VERSION_NUMBER < 0x1000205fL
593-
594- * err = "at least OpenSSL 1.0.2e required but found " OPENSSL_VERSION_TEXT ;
595- return NGX_ERROR ;
596-
597- # else
598-
599547 ngx_stream_upstream_t * u ;
600548 ngx_ssl_conn_t * ssl_conn ;
601549 ngx_connection_t * c ;
@@ -620,30 +568,13 @@ ngx_stream_lua_ffi_proxy_ssl_clear_certs(ngx_stream_lua_request_t *r,
620568
621569 SSL_certs_clear (ssl_conn );
622570 return NGX_OK ;
623-
624- # endif /* OPENSSL_VERSION_NUMBER < 0x1000205fL */
625- #endif
626571}
627572
628573
629574int
630575ngx_stream_lua_ffi_proxy_ssl_set_der_certificate (ngx_stream_lua_request_t * r ,
631576 const char * data , size_t len , char * * err )
632577{
633- #ifdef LIBRESSL_VERSION_NUMBER
634-
635- * err = "LibreSSL not supported" ;
636- return NGX_ERROR ;
637-
638- #else
639-
640- # if OPENSSL_VERSION_NUMBER < 0x1000205fL
641-
642- * err = "at least OpenSSL 1.0.2e required but found " OPENSSL_VERSION_TEXT ;
643- return NGX_ERROR ;
644-
645- # else
646-
647578 ngx_stream_upstream_t * u ;
648579 ngx_ssl_conn_t * ssl_conn ;
649580 ngx_connection_t * c ;
@@ -722,9 +653,6 @@ ngx_stream_lua_ffi_proxy_ssl_set_der_certificate(ngx_stream_lua_request_t *r,
722653 ERR_clear_error ();
723654
724655 return NGX_ERROR ;
725-
726- # endif /* OPENSSL_VERSION_NUMBER < 0x1000205fL */
727- #endif
728656}
729657
730658
798726ngx_stream_lua_ffi_proxy_ssl_set_cert (ngx_stream_lua_request_t * r ,
799727 void * cdata , char * * err )
800728{
801- #ifdef LIBRESSL_VERSION_NUMBER
802-
803- * err = "LibreSSL not supported" ;
804- return NGX_ERROR ;
805-
806- #else
807-
808- # if OPENSSL_VERSION_NUMBER < 0x1000205fL
809-
810- * err = "at least OpenSSL 1.0.2e required but found " OPENSSL_VERSION_TEXT ;
811- return NGX_ERROR ;
812-
813- # else
814-
815729#ifdef OPENSSL_IS_BORINGSSL
816730 size_t i ;
817731#else
@@ -883,9 +797,6 @@ ngx_stream_lua_ffi_proxy_ssl_set_cert(ngx_stream_lua_request_t *r,
883797 ERR_clear_error ();
884798
885799 return NGX_ERROR ;
886-
887- # endif /* OPENSSL_VERSION_NUMBER < 0x1000205fL */
888- #endif
889800}
890801
891802
@@ -936,69 +847,4 @@ ngx_stream_lua_ffi_proxy_ssl_set_priv_key(ngx_stream_lua_request_t *r,
936847 return NGX_ERROR ;
937848}
938849
939-
940- #else /* HAVE_PROXY_SSL_PATCH */
941-
942-
943- int
944- ngx_stream_lua_ffi_proxy_ssl_get_tls1_version (ngx_stream_lua_request_t * r ,
945- char * * err )
946- {
947- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
948-
949- return NGX_ERROR ;
950- }
951-
952-
953- int
954- ngx_stream_lua_ffi_proxy_ssl_clear_certs (ngx_stream_lua_request_t * r ,
955- char * * err )
956- {
957- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
958-
959- return NGX_ERROR ;
960- }
961-
962-
963- int
964- ngx_stream_lua_ffi_proxy_ssl_set_der_certificate (ngx_stream_lua_request_t * r ,
965- const char * data , size_t len , char * * err )
966- {
967- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
968-
969- return NGX_ERROR ;
970- }
971-
972-
973- int
974- ngx_stream_lua_ffi_proxy_ssl_set_der_private_key (ngx_stream_lua_request_t * r ,
975- const char * data , size_t len , char * * err )
976- {
977- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
978-
979- return NGX_ERROR ;
980- }
981-
982-
983- int
984- ngx_stream_lua_ffi_proxy_ssl_set_cert (ngx_stream_lua_request_t * r ,
985- void * cdata , char * * err )
986- {
987- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
988-
989- return NGX_ERROR ;
990- }
991-
992-
993- int
994- ngx_stream_lua_ffi_proxy_ssl_set_priv_key (ngx_stream_lua_request_t * r ,
995- void * cdata , char * * err )
996- {
997- * err = "Does not have HAVE_PROXY_SSL_PATCH to support this function" ;
998-
999- return NGX_ERROR ;
1000- }
1001-
1002-
1003- #endif /* HAVE_PROXY_SSL_PATCH */
1004- #endif /* NGX_STREAM_SSL */
850+ #endif /* HAVE_LUA_PROXY_SSL */
0 commit comments