Extend TLSProxy capabilities

Add ServerHello parsing to TLSProxy.
Also add some (very) limited ServerKeyExchange parsing.
Add the capability to set client and server cipher lists
Fix a bug with fragment lengths

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Matt Caswell
2015-08-07 14:38:21 +01:00
parent 011467ee55
commit a1accbb1d7
4 changed files with 482 additions and 7 deletions

View File

@@ -98,6 +98,7 @@ my $success = 0;
my $end = 0;
my @message_rec_list = ();
my @message_frag_lens = ();
my $ciphersuite = 0;
sub clear
{
@@ -120,6 +121,8 @@ sub get_messages
my @messages = ();
my $message;
@message_frag_lens = ();
if ($serverin != $server && length($payload) != 0) {
die "Changed peer, but we still have fragment data\n";
}
@@ -252,6 +255,24 @@ sub create_message
[@message_frag_lens]
);
$message->parse();
} elsif ($mt == MT_SERVER_HELLO) {
$message = TLSProxy::ServerHello->new(
$server,
$data,
[@message_rec_list],
$startoffset,
[@message_frag_lens]
);
$message->parse();
} elsif ($mt == MT_SERVER_KEY_EXCHANGE) {
$message = TLSProxy::ServerKeyExchange->new(
$server,
$data,
[@message_rec_list],
$startoffset,
[@message_frag_lens]
);
$message->parse();
} else {
#Unknown message type
$message = TLSProxy::Message->new(
@@ -277,7 +298,11 @@ sub success
my $class = shift;
return $success;
}
sub fail
{
my $class = shift;
return !$success && $end;
}
sub new
{
my $class = shift;
@@ -300,6 +325,15 @@ sub new
return bless $self, $class;
}
sub ciphersuite
{
my $class = shift;
if (@_) {
$ciphersuite = shift;
}
return $ciphersuite;
}
#Update all the underlying records with the modified data from this message
#Note: Does not currently support re-encrypting
sub repack