Mercurial > hg > nginx-quic
diff src/event/quic/ngx_event_quic_protection.c @ 8683:de7b9af30fc6 quic
QUIC: refactored packet creation.
The "min" and "max" arguments refer to UDP datagram size. Generating payload
requires to account properly for header size, which is variable and depends on
payload size and packet number.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 07 Oct 2021 13:48:29 +0300 |
parents | 6d1488b62dc5 |
children | 3341e4089c6c |
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_protection.c +++ b/src/event/quic/ngx_event_quic_protection.c @@ -836,11 +836,10 @@ ngx_quic_create_packet(ngx_quic_header_t ngx_quic_ciphers_t ciphers; u_char nonce[NGX_QUIC_IV_LEN], mask[NGX_QUIC_HP_LEN]; - out.len = pkt->payload.len + EVP_GCM_TLS_TAG_LEN; + ad.data = res->data; + ad.len = ngx_quic_create_header(pkt, ad.data, &pnp); - ad.data = res->data; - ad.len = ngx_quic_create_header(pkt, ad.data, out.len, &pnp); - + out.len = pkt->payload.len + EVP_GCM_TLS_TAG_LEN; out.data = res->data + ad.len; #ifdef NGX_QUIC_DEBUG_CRYPTO