summaryrefslogtreecommitdiffhomepage
path: root/src/event/quic/ngx_event_quic_ssl.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2023-02-22 19:16:53 +0400
committerRoman Arutyunyan <arut@nginx.com>2023-02-22 19:16:53 +0400
commita36ebf7e95baebf445b0973bd270bc009b0b0e9a (patch)
tree28f396ec4a7a6a828a8ee3e7f05b5e56ebbfecf4 /src/event/quic/ngx_event_quic_ssl.c
parent76adb919138225b24280bc477ff468fd13cc9e62 (diff)
downloadnginx-a36ebf7e95baebf445b0973bd270bc009b0b0e9a.tar.gz
nginx-a36ebf7e95baebf445b0973bd270bc009b0b0e9a.tar.bz2
QUIC: OpenSSL compatibility layer.
The change allows to compile QUIC with OpenSSL which lacks BoringSSL QUIC API. This implementation does not support 0-RTT.
Diffstat (limited to 'src/event/quic/ngx_event_quic_ssl.c')
-rw-r--r--src/event/quic/ngx_event_quic_ssl.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/event/quic/ngx_event_quic_ssl.c b/src/event/quic/ngx_event_quic_ssl.c
index f23260d24..6b0bae1ed 100644
--- a/src/event/quic/ngx_event_quic_ssl.c
+++ b/src/event/quic/ngx_event_quic_ssl.c
@@ -10,6 +10,13 @@
#include <ngx_event_quic_connection.h>
+#if defined OPENSSL_IS_BORINGSSL \
+ || defined LIBRESSL_VERSION_NUMBER \
+ || NGX_QUIC_OPENSSL_COMPAT
+#define NGX_QUIC_BORINGSSL_API 1
+#endif
+
+
/*
* RFC 9000, 7.5. Cryptographic Message Buffering
*
@@ -18,7 +25,7 @@
#define NGX_QUIC_MAX_BUFFERED 65535
-#if defined OPENSSL_IS_BORINGSSL || defined LIBRESSL_VERSION_NUMBER
+#if (NGX_QUIC_BORINGSSL_API)
static int ngx_quic_set_read_secret(ngx_ssl_conn_t *ssl_conn,
enum ssl_encryption_level_t level, const SSL_CIPHER *cipher,
const uint8_t *secret, size_t secret_len);
@@ -39,7 +46,7 @@ static int ngx_quic_send_alert(ngx_ssl_conn_t *ssl_conn,
static ngx_int_t ngx_quic_crypto_input(ngx_connection_t *c, ngx_chain_t *data);
-#if defined OPENSSL_IS_BORINGSSL || defined LIBRESSL_VERSION_NUMBER
+#if (NGX_QUIC_BORINGSSL_API)
static int
ngx_quic_set_read_secret(ngx_ssl_conn_t *ssl_conn,
@@ -523,7 +530,7 @@ ngx_quic_init_connection(ngx_connection_t *c)
ssl_conn = c->ssl->connection;
if (!quic_method.send_alert) {
-#if defined OPENSSL_IS_BORINGSSL || defined LIBRESSL_VERSION_NUMBER
+#if (NGX_QUIC_BORINGSSL_API)
quic_method.set_read_secret = ngx_quic_set_read_secret;
quic_method.set_write_secret = ngx_quic_set_write_secret;
#else