From: Frederik Wedel-Heinen Date: Tue, 23 Jan 2024 14:11:03 +0000 (+0100) Subject: Adds dtls 1.3 support in TLS::Proxy X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=031697cf690aa076cac3e5908b90dce084c9535f;p=thirdparty%2Fopenssl.git Adds dtls 1.3 support in TLS::Proxy Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23375) --- diff --git a/util/perl/TLSProxy/Record.pm b/util/perl/TLSProxy/Record.pm index 460991e8aa8..f55e4ac3a48 100644 --- a/util/perl/TLSProxy/Record.pm +++ b/util/perl/TLSProxy/Record.pm @@ -36,6 +36,7 @@ my %record_type = ( ); use constant { + VERS_DTLS_1_3 => 0xfefc, VERS_DTLS_1_2 => 0xfefd, VERS_DTLS_1 => 0xfeff, VERS_TLS_1_4 => 0x0305, @@ -48,6 +49,7 @@ use constant { }; our %tls_version = ( + VERS_DTLS_1_3, "DTLS1.3", VERS_DTLS_1_2, "DTLS1.2", VERS_DTLS_1, "DTLS1", VERS_TLS_1_3, "TLS1.3", @@ -391,21 +393,17 @@ sub reconstruct_record if ($self->sslv2) { $data = pack('n', $self->len | 0x8000); } else { + my $content_type = (TLSProxy::Proxy->is_tls13() && $self->encrypted) + ? $self->outer_content_type : $self->content_type; if($self->{isdtls}) { my $seqhi = ($self->seq >> 32) & 0xffff; my $seqmi = ($self->seq >> 16) & 0xffff; my $seqlo = ($self->seq >> 0) & 0xffff; - $data = pack('Cnnnnnn', $self->content_type, $self->version, + $data = pack('Cnnnnnn', $content_type, $self->version, $self->epoch, $seqhi, $seqmi, $seqlo, $self->len); } else { - if (TLSProxy::Proxy->is_tls13() && $self->encrypted) { - $data = pack('Cnn', $self->outer_content_type, $self->version, - $self->len); - } - else { - $data = pack('Cnn', $self->content_type, $self->version, - $self->len); - } + $data = pack('Cnn', $content_type, $self->version, + $self->len); } } diff --git a/util/perl/TLSProxy/ServerHello.pm b/util/perl/TLSProxy/ServerHello.pm index a1dabaa2b38..3741898a3e2 100644 --- a/util/perl/TLSProxy/ServerHello.pm +++ b/util/perl/TLSProxy/ServerHello.pm @@ -111,7 +111,8 @@ sub parse if ($random eq $hrrrandom) { TLSProxy::Proxy->is_tls13(1); - } elsif ($neg_version == TLSProxy::Record::VERS_TLS_1_3) { + } elsif ($neg_version == TLSProxy::Record::VERS_TLS_1_3 + || $neg_version == TLSProxy::Record::VERS_DTLS_1_3) { TLSProxy::Proxy->is_tls13(1); TLSProxy::Record->server_encrypting(1);