diff options
author | Matt Caswell <matt@openssl.org> | 2016-11-07 14:26:41 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-11-07 15:52:33 +0000 |
commit | 8e47ee18c8f7e59575effdd8dfcfbfff1a365ede (patch) | |
tree | b67c707c06a9f856a3cc0621ac74c5d46f4765c2 /test | |
parent | 3c9539d294b931bc430a01510753e10b7a201f11 (diff) | |
download | openssl-8e47ee18c8f7e59575effdd8dfcfbfff1a365ede.tar.gz |
Add a test for the wrong version number in a record
Prior to TLS1.3 we check that the received record version number is correct.
In TLS1.3 we need to ignore the record version number. This adds a test to
make sure we do it correctly.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/recipes/70-test_sslrecords.t | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/recipes/70-test_sslrecords.t b/test/recipes/70-test_sslrecords.t index b282dbd86f..cafa30ce3c 100644 --- a/test/recipes/70-test_sslrecords.t +++ b/test/recipes/70-test_sslrecords.t @@ -39,10 +39,13 @@ my $content_type = TLSProxy::Record::RT_APPLICATION_DATA; 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"); @@ -137,6 +140,21 @@ if (!disabled("tls1_1")) { 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; @@ -388,3 +406,15 @@ sub add_unknown_record_type 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); +} |