summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm')
-rw-r--r--deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm38
1 files changed, 32 insertions, 6 deletions
diff --git a/deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm b/deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm
index 79a8be9a89..84f2faab05 100644
--- a/deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm
+++ b/deps/openssl/openssl/util/perl/TLSProxy/ServerHello.pm
@@ -1,4 +1,4 @@
-# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@@ -12,6 +12,11 @@ package TLSProxy::ServerHello;
use vars '@ISA';
push @ISA, 'TLSProxy::Message';
+my $hrrrandom = pack("C*", 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE,
+ 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91, 0xC2, 0xA2,
+ 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E, 0x07, 0x9E, 0x09,
+ 0xE2, 0xC8, 0xA8, 0x33, 0x9C);
+
sub new
{
my $class = shift;
@@ -45,16 +50,23 @@ sub parse
my $self = shift;
my $ptr = 2;
my ($server_version) = unpack('n', $self->data);
+ my $neg_version = $server_version;
+
my $random = substr($self->data, $ptr, 32);
$ptr += 32;
- my $session_id_len = unpack('C', substr($self->data, $ptr));
+ my $session_id_len = 0;
+ my $session = "";
+ $session_id_len = unpack('C', substr($self->data, $ptr));
$ptr++;
- my $session = substr($self->data, $ptr, $session_id_len);
+ $session = substr($self->data, $ptr, $session_id_len);
$ptr += $session_id_len;
+
my $ciphersuite = unpack('n', substr($self->data, $ptr));
$ptr += 2;
- my $comp_meth = unpack('C', substr($self->data, $ptr));
+ my $comp_meth = 0;
+ $comp_meth = unpack('C', substr($self->data, $ptr));
$ptr++;
+
my $extensions_len = unpack('n', substr($self->data, $ptr));
if (!defined $extensions_len) {
$extensions_len = 0;
@@ -82,6 +94,18 @@ sub parse
my $extdata = substr($extension_data, 4, $size);
$extension_data = substr($extension_data, 4 + $size);
$extensions{$type} = $extdata;
+ if ($type == TLSProxy::Message::EXT_SUPPORTED_VERSIONS) {
+ $neg_version = unpack('n', $extdata);
+ }
+ }
+
+ if ($random eq $hrrrandom) {
+ TLSProxy::Proxy->is_tls13(1);
+ } elsif ($neg_version == TLSProxy::Record::VERS_TLS_1_3) {
+ TLSProxy::Proxy->is_tls13(1);
+
+ TLSProxy::Record->server_encrypting(1);
+ TLSProxy::Record->client_encrypting(1);
}
$self->server_version($server_version);
@@ -89,11 +113,13 @@ sub parse
$self->session_id_len($session_id_len);
$self->session($session);
$self->ciphersuite($ciphersuite);
+ TLSProxy::Proxy->ciphersuite($ciphersuite);
$self->comp_meth($comp_meth);
$self->extension_data(\%extensions);
$self->process_data();
+
print " Server Version:".$server_version."\n";
print " Session ID Len:".$session_id_len."\n";
print " Ciphersuite:".$ciphersuite."\n";
@@ -145,9 +171,9 @@ sub server_version
{
my $self = shift;
if (@_) {
- $self->{client_version} = shift;
+ $self->{server_version} = shift;
}
- return $self->{client_version};
+ return $self->{server_version};
}
sub random
{