comparison lib/Test/Nginx/HTTP3.pm @ 1914:afbf4c06c014

Tests: fixed croak sending QUIC Initial with CCM cipher negotiated.
author Sergey Kandaurov <pluknet@nginx.com>
date Fri, 16 Jun 2023 14:54:11 +0400
parents e0b53fbdb5cf
children 15131dd931a0
comparison
equal deleted inserted replaced
1913:032ccd3118cb 1914:afbf4c06c014
1760 $ad .= build_int(length($payload) + 16 + 4) unless $level == 3; 1760 $ad .= build_int(length($payload) + 16 + 4) unless $level == 3;
1761 $ad .= pack("N", $pn); 1761 $ad .= pack("N", $pn);
1762 my $nonce = substr(pack("x12") . pack("N", $pn), -12) 1762 my $nonce = substr(pack("x12") . pack("N", $pn), -12)
1763 ^ $self->{keys}[$level]{w}{iv}; 1763 ^ $self->{keys}[$level]{w}{iv};
1764 my ($f, @args) = encrypt_aead_f($level, $self->{cipher}); 1764 my ($f, @args) = encrypt_aead_f($level, $self->{cipher});
1765 my @taglen = ($level != 0 && $self->{cipher} == 0x1304) ? 16 : ();
1765 my ($ciphertext, $tag) = $f->(@args, 1766 my ($ciphertext, $tag) = $f->(@args,
1766 $self->{keys}[$level]{w}{key}, $nonce, $ad, 1767 $self->{keys}[$level]{w}{key}, $nonce, $ad, @taglen, $payload);
1767 $self->{cipher} == 0x1304 ? 16 : (), $payload);
1768 my $sample = substr($ciphertext . $tag, 0, 16); 1768 my $sample = substr($ciphertext . $tag, 0, 16);
1769 1769
1770 $ad = $self->encrypt_ad($ad, $self->{keys}[$level]{w}{hp}, 1770 $ad = $self->encrypt_ad($ad, $self->{keys}[$level]{w}{hp},
1771 $sample, $level); 1771 $sample, $level);
1772 return $ad . $ciphertext . $tag; 1772 return $ad . $ciphertext . $tag;