# HG changeset patch # User Sergey Kandaurov # Date 1618306714 -10800 # Node ID b4e6b7049984e0ba17faf8b9ae538f5559fec467 # Parent 915c2f7092ed351999336a912f3067e416b1d079 QUIC: normalize header inclusion. Stop including QUIC headers with no user-serviceable parts inside. This allows to provide a much cleaner QUIC interface. To cope with that, ngx_quic_derive_key() is now explicitly exported for v3 and quic modules. Additionally, this completely hides the ngx_quic_keys_t internal type. diff --git a/src/event/quic/ngx_event_quic.h b/src/event/quic/ngx_event_quic.h --- a/src/event/quic/ngx_event_quic.h +++ b/src/event/quic/ngx_event_quic.h @@ -85,9 +85,6 @@ struct ngx_quic_stream_s { }; -typedef struct ngx_quic_keys_s ngx_quic_keys_t; - - void ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf); ngx_connection_t *ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi); void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err, @@ -98,5 +95,7 @@ ngx_int_t ngx_quic_reset_stream(ngx_conn uint32_t ngx_quic_version(ngx_connection_t *c); ngx_int_t ngx_quic_get_packet_dcid(ngx_log_t *log, u_char *data, size_t len, ngx_str_t *dcid); +ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label, + ngx_str_t *secret, ngx_str_t *salt, u_char *out, size_t len); #endif /* _NGX_EVENT_QUIC_H_INCLUDED_ */ diff --git a/src/event/quic/ngx_event_quic_connection.h b/src/event/quic/ngx_event_quic_connection.h --- a/src/event/quic/ngx_event_quic_connection.h +++ b/src/event/quic/ngx_event_quic_connection.h @@ -11,12 +11,12 @@ #include #include +typedef struct ngx_quic_connection_s ngx_quic_connection_t; +typedef struct ngx_quic_send_ctx_s ngx_quic_send_ctx_t; +typedef struct ngx_quic_keys_s ngx_quic_keys_t; + #include #include - -typedef struct ngx_quic_connection_s ngx_quic_connection_t; -typedef struct ngx_quic_send_ctx_s ngx_quic_send_ctx_t; - #include #include #include diff --git a/src/event/quic/ngx_event_quic_protection.c b/src/event/quic/ngx_event_quic_protection.c --- a/src/event/quic/ngx_event_quic_protection.c +++ b/src/event/quic/ngx_event_quic_protection.c @@ -7,8 +7,7 @@ #include #include #include -#include -#include +#include #define NGX_QUIC_IV_LEN 12 diff --git a/src/event/quic/ngx_event_quic_protection.h b/src/event/quic/ngx_event_quic_protection.h --- a/src/event/quic/ngx_event_quic_protection.h +++ b/src/event/quic/ngx_event_quic_protection.h @@ -29,8 +29,6 @@ void ngx_quic_keys_discard(ngx_quic_keys enum ssl_encryption_level_t level); void ngx_quic_keys_switch(ngx_connection_t *c, ngx_quic_keys_t *keys); ngx_int_t ngx_quic_keys_update(ngx_connection_t *c, ngx_quic_keys_t *keys); -ngx_int_t ngx_quic_derive_key(ngx_log_t *log, const char *label, - ngx_str_t *secret, ngx_str_t *salt, u_char *out, size_t len); ngx_int_t ngx_quic_encrypt(ngx_quic_header_t *pkt, ngx_str_t *res); ngx_int_t ngx_quic_decrypt(ngx_quic_header_t *pkt, uint64_t *largest_pn); diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -7,9 +7,7 @@ #include #include #include -#include #include -#include #define NGX_QUIC_STREAM_GONE (void *) -1 diff --git a/src/event/quic/ngx_event_quic_tokens.c b/src/event/quic/ngx_event_quic_tokens.c --- a/src/event/quic/ngx_event_quic_tokens.c +++ b/src/event/quic/ngx_event_quic_tokens.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #define NGX_QUIC_MAX_TOKEN_SIZE 64 diff --git a/src/event/quic/ngx_event_quic_transport.c b/src/event/quic/ngx_event_quic_transport.c --- a/src/event/quic/ngx_event_quic_transport.c +++ b/src/event/quic/ngx_event_quic_transport.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #define NGX_QUIC_LONG_DCID_LEN_OFFSET 5 diff --git a/src/http/modules/ngx_http_quic_module.c b/src/http/modules/ngx_http_quic_module.c --- a/src/http/modules/ngx_http_quic_module.c +++ b/src/http/modules/ngx_http_quic_module.c @@ -9,8 +9,6 @@ #include #include -#include - static ngx_int_t ngx_http_variable_quic(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data); diff --git a/src/stream/ngx_stream_quic_module.c b/src/stream/ngx_stream_quic_module.c --- a/src/stream/ngx_stream_quic_module.c +++ b/src/stream/ngx_stream_quic_module.c @@ -9,8 +9,6 @@ #include #include -#include - static ngx_int_t ngx_stream_variable_quic(ngx_stream_session_t *s, ngx_stream_variable_value_t *v, uintptr_t data);