my $inject_recs_num = 1;
$proxy->serverflags("-tls1_2");
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
-my $num_tests = 10;
+my $num_tests = 11;
if (!disabled("tls1_1")) {
$num_tests++;
}
+if (!disabled("tls1_3")) {
+ $num_tests++;
+}
plan tests => $num_tests;
ok(TLSProxy::Message->fail(), "Out of context empty records test");
ok(TLSProxy::Message->fail(), "Unrecognised record type in TLS1.1");
}
+#Test 12: Sending a different record version in TLS1.2 should fail
+$proxy->clear();
+$proxy->clientflags("-tls1_2");
+$proxy->filter(\&change_version);
+$proxy->start();
+ok(TLSProxy::Message->fail(), "Changed record version in TLS1.2");
+
+#Test 13: Sending a different record version in TLS1.3 should succeed
+if (!disabled("tls1_3")) {
+ $proxy->clear();
+ $proxy->filter(\&change_version);
+ $proxy->start();
+ ok(TLSProxy::Message->success(), "Changed record version in TLS1.3");
+}
+
sub add_empty_recs_filter
{
my $proxy = shift;
unshift @{$proxy->record_list}, $record;
}
+
+sub change_version
+{
+ my $proxy = shift;
+
+ # We'll change a version after the initial version neg has taken place
+ if ($proxy->flight != 2) {
+ return;
+ }
+
+ (${$proxy->record_list}[-1])->version(TLSProxy::Record::VERS_TLS_1_1);
+}
my $self = shift;
return $self->{content_type};
}
-sub version
-{
- my $self = shift;
- return $self->{version};
-}
sub sslv2
{
my $self = shift;
}
return $self->{len};
}
+sub version
+{
+ my $self = shift;
+ if (@_) {
+ $self->{version} = shift;
+ }
+ return $self->{version};
+}
1;