X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=test%2Frecipes%2F70-test_sslversions.t;h=6044a05954fb7fa8996e8c595580d91f70a9a275;hp=0ee15561dabe9f0502e5d5e6776f9f572f3f4743;hb=2d729db2f0c047e64c580342f6fba0d99b2ada50;hpb=17d01b420151d05edd347b584fa1942f5b914fc5 diff --git a/test/recipes/70-test_sslversions.t b/test/recipes/70-test_sslversions.t old mode 100755 new mode 100644 index 0ee15561da..6044a05954 --- a/test/recipes/70-test_sslversions.t +++ b/test/recipes/70-test_sslversions.t @@ -17,7 +17,7 @@ use constant { UNRECOGNISED_VERSIONS => 2, NO_EXTENSION => 3, EMPTY_EXTENSION => 4, - NO_TLS1_3 => 5, + TLS1_1_AND_1_0_ONLY => 5, WITH_TLS1_4 => 6 }; @@ -87,18 +87,19 @@ $testtype = REVERSE_ORDER_VERSIONS; $proxy->start(); $record = pop @{$proxy->record_list}; ok(TLSProxy::Message->success() - && $record->version() == TLSProxy::Record::VERS_TLS_1_3, + && $record->version() == TLSProxy::Record::VERS_TLS_1_2 + && TLSProxy::Proxy->is_tls13(), "Reverse order versions"); #Test 6: no TLSv1.3 or TLSv1.2 version in supported versions extension, but #TLSv1.1 and TLSv1.0 are present. Should just use TLSv1.1 and succeed $proxy->clear(); -$testtype = NO_TLS1_3; +$testtype = TLS1_1_AND_1_0_ONLY; $proxy->start(); $record = pop @{$proxy->record_list}; ok(TLSProxy::Message->success() && $record->version() == TLSProxy::Record::VERS_TLS_1_1, - "No TLS1.3 in supported versions extension"); + "TLS1.1 and TLS1.0 in supported versions extension only"); #Test 7: TLS1.4 and TLS1.3 in supported versions. Should succeed and use TLS1.3 $proxy->clear(); @@ -106,13 +107,25 @@ $testtype = WITH_TLS1_4; $proxy->start(); $record = pop @{$proxy->record_list}; ok(TLSProxy::Message->success() - && $record->version() == TLSProxy::Record::VERS_TLS_1_3, + && $record->version() == TLSProxy::Record::VERS_TLS_1_2 + && TLSProxy::Proxy->is_tls13(), "TLS1.4 in supported versions extension"); sub modify_supported_versions_filter { my $proxy = shift; + if ($proxy->flight == 1) { + # Change the ServerRandom so that the downgrade sentinel doesn't cause + # the connection to fail + my $message = ${$proxy->message_list}[1]; + return if (!defined $message); + + $message->random("\0"x32); + $message->repack(); + return; + } + # We're only interested in the initial ClientHello if ($proxy->flight != 0) { return; @@ -131,7 +144,7 @@ sub modify_supported_versions_filter 0x04, # Length 0x04, 0x04, #Some unrecognised version 0x04, 0x03; #Another unrecognised version - } elsif ($testtype == NO_TLS1_3) { + } elsif ($testtype == TLS1_1_AND_1_0_ONLY) { $ext = pack "C5", 0x04, # Length 0x03, 0x02, #TLSv1.1 @@ -144,7 +157,7 @@ sub modify_supported_versions_filter } if ($testtype == REVERSE_ORDER_VERSIONS || $testtype == UNRECOGNISED_VERSIONS - || $testtype == NO_TLS1_3 + || $testtype == TLS1_1_AND_1_0_ONLY || $testtype == WITH_TLS1_4) { $message->set_extension( TLSProxy::Message::EXT_SUPPORTED_VERSIONS, $ext);