Fixed header protection application with pn length > 1.

This commit is contained in:
Sergey Kandaurov 2020-03-14 03:15:09 +03:00
parent 11dfc1c943
commit 1ac31c01b4

View File

@ -1637,7 +1637,10 @@ ngx_quic_decrypt(ngx_connection_t *c, ngx_quic_header_t *pkt)
ngx_memcpy(ad.data, pkt->data, ad.len); ngx_memcpy(ad.data, pkt->data, ad.len);
ad.data[0] = clearflags; ad.data[0] = clearflags;
ad.data[ad.len - pnl] = (u_char) pn;
do {
ad.data[ad.len - pnl] = pn >> (8 * (pnl - 1)) % 256;
} while (--pnl);
nonce = ngx_pstrdup(c->pool, &pkt->secret->iv); nonce = ngx_pstrdup(c->pool, &pkt->secret->iv);
nonce[11] ^= pn; nonce[11] ^= pn;