提交 357d096a 编写于 作者: M Matt Caswell

Teach TLSProxy how to re-encrypt a TLSv1.3 message after changes

This enables us to make changes to in-flight TLSv1.3 messages that appear
after the ServerHello.
Reviewed-by: NRich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2157)
上级 79d8c167
...@@ -367,7 +367,7 @@ sub ciphersuite ...@@ -367,7 +367,7 @@ sub ciphersuite
} }
#Update all the underlying records with the modified data from this message #Update all the underlying records with the modified data from this message
#Note: Does not currently support re-encrypting #Note: Only supports re-encrypting for TLSv1.3
sub repack sub repack
{ {
my $self = shift; my $self = shift;
...@@ -410,8 +410,14 @@ sub repack ...@@ -410,8 +410,14 @@ sub repack
# use an explicit override field instead.) # use an explicit override field instead.)
$rec->decrypt_len(length($rec->decrypt_data)); $rec->decrypt_len(length($rec->decrypt_data));
$rec->len($rec->len + length($msgdata) - $old_length); $rec->len($rec->len + length($msgdata) - $old_length);
# Don't support re-encryption. # Only support re-encryption for TLSv1.3.
$rec->data($rec->decrypt_data); if (TLSProxy::Proxy->is_tls13() && $rec->encrypted()) {
#Add content type (1 byte) and 16 tag bytes
$rec->data($rec->decrypt_data
.pack("C", TLSProxy::Record::RT_HANDSHAKE).("\0"x16));
} else {
$rec->data($rec->decrypt_data);
}
#Update the fragment len in case we changed it above #Update the fragment len in case we changed it above
${$self->message_frag_lens}[0] = length($msgdata) ${$self->message_frag_lens}[0] = length($msgdata)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册