|
22 | 22 | #include "ngx_stream_lua_proxy_ssl_verifyby.h" |
23 | 23 |
|
24 | 24 |
|
| 25 | +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x30000020uL) |
25 | 26 | static void ngx_stream_lua_proxy_ssl_verify_done(void *data); |
26 | 27 | static void ngx_stream_lua_proxy_ssl_verify_aborted(void *data); |
| 28 | +#endif |
27 | 29 | static ngx_int_t ngx_stream_lua_proxy_ssl_verify_by_chunk(lua_State *L, |
28 | 30 | ngx_stream_lua_request_t *r); |
29 | 31 |
|
@@ -82,7 +84,7 @@ ngx_stream_lua_proxy_ssl_verify_set_callback(ngx_conf_t *cf) |
82 | 84 | return NGX_ERROR; |
83 | 85 | } |
84 | 86 |
|
85 | | -#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \ |
| 87 | +#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \ |
86 | 88 | || OPENSSL_VERSION_NUMBER < 0x30000020L) |
87 | 89 |
|
88 | 90 | ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "OpenSSL too old to support " |
@@ -184,8 +186,8 @@ ngx_stream_lua_proxy_ssl_verify_by_lua(ngx_conf_t *cf, ngx_command_t *cmd, |
184 | 186 |
|
185 | 187 | #else |
186 | 188 |
|
187 | | -#if (!defined SSL_ERROR_WANT_RETRY_VERIFY \ |
188 | | - || OPENSSL_VERSION_NUMBER < 0x30000020L) |
| 189 | +#if !defined(SSL_ERROR_WANT_RETRY_VERIFY) \ |
| 190 | + || (OPENSSL_VERSION_NUMBER < 0x30000020L) |
189 | 191 |
|
190 | 192 | /* SSL_set_retry_verify() was added in OpenSSL 3.0.2 */ |
191 | 193 | ngx_log_error(NGX_LOG_EMERG, cf->log, 0, |
@@ -289,6 +291,13 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg) |
289 | 291 |
|
290 | 292 | return 1; |
291 | 293 |
|
| 294 | +#elif defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER < 0x30000020uL) |
| 295 | + |
| 296 | + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
| 297 | + "OpenSSL(< 3.0.2) does not support by proxy_ssl_verify_by_lua*"); |
| 298 | + |
| 299 | + return 1; |
| 300 | + |
292 | 301 | #else |
293 | 302 |
|
294 | 303 | lua_State *L; |
@@ -397,7 +406,8 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg) |
397 | 406 |
|
398 | 407 | ngx_log_debug2(NGX_LOG_DEBUG_STREAM, c->log, 0, |
399 | 408 | "proxy_ssl_verify_by_lua: handler return value: %i, " |
400 | | - "cert verify callback exit code: %d", rc, cctx->exit_code); |
| 409 | + "cert verify callback exit code: %d", |
| 410 | + rc, cctx->exit_code); |
401 | 411 |
|
402 | 412 | c->log->action = "proxy pass SSL handshaking"; |
403 | 413 | return cctx->exit_code; |
@@ -441,6 +451,7 @@ ngx_stream_lua_proxy_ssl_verify_handler(X509_STORE_CTX *x509_store, void *arg) |
441 | 451 | } |
442 | 452 |
|
443 | 453 |
|
| 454 | +#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x30000020uL) |
444 | 455 | static void |
445 | 456 | ngx_stream_lua_proxy_ssl_verify_done(void *data) |
446 | 457 | { |
@@ -500,6 +511,7 @@ ngx_stream_lua_proxy_ssl_verify_aborted(void *data) |
500 | 511 | cctx->pool = NULL; |
501 | 512 | } |
502 | 513 | } |
| 514 | +#endif |
503 | 515 |
|
504 | 516 |
|
505 | 517 | static ngx_int_t |
|
0 commit comments