Skip to content

Commit fe05bad

Browse files
committed
Tests: added QUIC tests for discarding 0-RTT keys.
Discarding 0-RTT keys shouldn't affect 1-RTT send queue.
1 parent 7895728 commit fe05bad

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

h3_ssl_early_data.t

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ select STDERR; $| = 1;
2424
select STDOUT; $| = 1;
2525

2626
my $t = Test::Nginx->new()->has(qw/http http_v3 cryptx/)
27-
->has_daemon('openssl')->plan(5)
27+
->has_daemon('openssl')->plan(6)
2828
->write_file_expand('nginx.conf', <<'EOF');
2929
3030
%%TEST_GLOBALS%%
@@ -84,7 +84,8 @@ local $TODO = 'no TLSv1.3 sessions in LibreSSL' if $t->has_module('LibreSSL');
8484

8585
my $psk_list = $s->{psk_list};
8686

87-
$s = Test::Nginx::HTTP3->new(8980, psk_list => $psk_list, early_data => {});
87+
$s = Test::Nginx::HTTP3->new(8980, psk_list => $psk_list, early_data => {},
88+
start_chain => 1);
8889

8990
TODO: {
9091
local $TODO = 'no 0-RTT in OpenSSL compat layer'
@@ -99,7 +100,19 @@ is($frame->{headers}->{'x-early'}, '1', 'reused session is early');
99100

100101
}
101102

103+
$s->send_chain();
104+
102105
$frames = $s->read(all => [{ sid => $s->new_stream(), fin => 1 }]);
106+
107+
TODO: {
108+
local $TODO = 'not yet'
109+
if $t->has_version('1.27.1') && !$t->has_version('1.27.4');
110+
111+
($frame) = grep { $_->{type} eq "HANDSHAKE_DONE" } @$frames;
112+
ok($frame, '1rtt after discarding 0rtt');
113+
114+
}
115+
103116
($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
104117
is($frame->{headers}->{'x-session'}, 'r', 'reused session 1rtt');
105118
is($frame->{headers}->{'x-early'}, undef, 'reused session not early');

lib/Test/Nginx/HTTP3.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ sub new {
4949
$self->{ciphers} = $extra{ciphers} || "\x13\x01";
5050
$self->{group} = $extra{group} || 'x25519';
5151
$self->{opts} = $extra{opts};
52+
$self->{chaining} = $extra{start_chain} || 0;
5253

5354
$self->{zero} = pack("x5");
5455

@@ -246,7 +247,7 @@ sub handshake {
246247
"resumption = " . unpack("H*", $self->{rms_prk}));
247248

248249
my $crypto = build_crypto($finished);
249-
$self->{socket}->syswrite($self->encrypt_aead($crypto, 2));
250+
$self->raw_write($crypto, 2);
250251
}
251252

252253
sub DESTROY {

0 commit comments

Comments
 (0)