Fixed computing nonce again, by properly shifting packet number.

This commit is contained in:
Sergey Kandaurov 2020-04-03 13:49:40 +03:00
parent 723c276a7b
commit 569da72e4b

View File

@ -787,10 +787,10 @@ ngx_quic_parse_pn(u_char **pos, ngx_int_t len, u_char *mask)
static void static void
ngx_quic_compute_nonce(u_char *nonce, size_t len, uint64_t pn) ngx_quic_compute_nonce(u_char *nonce, size_t len, uint64_t pn)
{ {
nonce[len - 4] ^= pn & 0xff000000; nonce[len - 4] ^= (pn & 0xff000000) >> 24;
nonce[len - 3] ^= pn & 0x00ff0000; nonce[len - 3] ^= (pn & 0x00ff0000) >> 16;
nonce[len - 2] ^= pn & 0x0000ff00; nonce[len - 2] ^= (pn & 0x0000ff00) >> 8;
nonce[len - 1] ^= pn & 0x000000ff; nonce[len - 1] ^= (pn & 0x000000ff);
} }