Send TLSv1.2 as the record version when using TLSv1.3
[openssl.git] / test / recipes / 70-test_sslversions.t
old mode 100755 (executable)
new mode 100644 (file)
index d2e6eb6..6044a05
@@ -87,7 +87,8 @@ $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
@@ -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;