Mercurial > hg > nginx-tests
diff ssl_session_ticket_key.t @ 1840:0381a0a212e1
Tests: fixed ssl_session_ticket_key.t with LibreSSL and TLSv1.3.
LibreSSL does not support session reuse with TLSv1.3.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 23 Mar 2023 19:50:13 +0300 |
parents | 5817625792bd |
children | 0e1865aa9b33 |
line wrap: on
line diff
--- a/ssl_session_ticket_key.t Thu Mar 23 19:50:08 2023 +0300 +++ b/ssl_session_ticket_key.t Thu Mar 23 19:50:13 2023 +0300 @@ -96,6 +96,10 @@ is(get_ticket_key_name(), $key, 'ticket key match'); select undef, undef, undef, 2.5; + +local $TODO = 'no TLSv1.3 sessions in LibreSSL' + if $t->has_module('LibreSSL') && test_tls13(); + cmp_ok(get_ticket_key_name(), 'ne', $key, 'ticket key next'); ############################################################################### @@ -107,7 +111,7 @@ next: # tag(10) | len{2} | OCTETSTRING(4) | len{2} | ticket(key_name|..) $asn =~ /\xaa\x81($any)\x04\x81($any)($any{16})/g; - return if !defined $3; + return '' if !defined $3; goto next if unpack("C", $1) - unpack("C", $2) != 3; my $key = unpack "H*", $3; Test::Nginx::log_core('||', "ticket key: $key"); @@ -126,6 +130,11 @@ Net::SSLeay::get_session($ssl); } +sub test_tls13 { + my ($s, $ssl) = get_ssl_socket(); + return (Net::SSLeay::version($ssl) > 0x303); +} + sub get_ssl_socket { my $s = IO::Socket::INET->new('127.0.0.1:' . port(8080)); my $ctx = Net::SSLeay::CTX_new() or die("Failed to create SSL_CTX $!");