From 018420bc70859914d8e12b3680299f2999bc68bd Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 17 Aug 2022 10:58:44 +0000 Subject: [PATCH] Use tls 1.3 by default in TestSSLContext. Due to the whole test update and revert thing that happened, some tests seemingly haven't been updated to expect 1.3 by default as it should be (see bug), so this cherrypick should help. Test: URLConnectionTest Test: m (cherry picked from https://android-review.googlesource.com/q/commit:c47e33ff55335db45afbfab60bb2c0e248b27a57) Bug: 291901467 Merged-In: I09d3297f64711c830957ea523a95740db208e047 Change-Id: I09d3297f64711c830957ea523a95740db208e047 --- luni/src/test/java/libcore/java/net/URLConnectionTest.java | 6 +++--- .../src/test/java/libcore/javax/net/ssl/TestSSLContext.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/luni/src/test/java/libcore/java/net/URLConnectionTest.java b/luni/src/test/java/libcore/java/net/URLConnectionTest.java index ddd447ad069..5988a8448c5 100644 --- a/luni/src/test/java/libcore/java/net/URLConnectionTest.java +++ b/luni/src/test/java/libcore/java/net/URLConnectionTest.java @@ -564,7 +564,7 @@ private void checkConnectViaHttps() throws IOException, InterruptedException { RecordedRequest request = server.takeRequest(); assertEquals("GET /foo HTTP/1.1", request.getRequestLine()); - assertEquals("TLSv1.2", request.getSslProtocol()); + assertEquals("TLSv1.3", request.getSslProtocol()); } @Test public void connectViaHttpsReusingConnections() throws IOException, InterruptedException { @@ -2285,7 +2285,7 @@ private void testResponseRedirectedWithPost(int redirectCode) throws Exception { + "CN=Local Host 3, " + "CN=Test Intermediate Certificate Authority 2, " + "CN=Test Root Certificate Authority 1" - + "] ECDHE_RSA"), + + "] GENERIC"), trustManager.calls); } finally { HttpsURLConnection.setDefaultHostnameVerifier(defaultHostnameVerifier); @@ -3094,7 +3094,7 @@ private void checkNoFallbackOnFailedHandshake(SSLSocketFactory clientSocketFacto @Test public void noSslFallback_defaultProtocols() throws Exception { // Will need to be updated if the enabled protocols in Android's SSLSocketFactory change - String[] expectedEnabledProtocols = { "TLSv1.2", "TLSv1.1", "TLSv1" }; + String[] expectedEnabledProtocols = { "TLSv1.3", "TLSv1.2", "TLSv1.1", "TLSv1" }; TestSSLContext testSSLContext = createDefaultTestSSLContext(); SSLSocketFactory serverSocketFactory = testSSLContext.serverContext.getSocketFactory(); diff --git a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java index bc6cd7cbbc0..ca96cadf9db 100644 --- a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java +++ b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java @@ -260,7 +260,7 @@ public static TestSSLContext create(TestKeyStore client, TestKeyStore server) { public static TestSSLContext createWithAdditionalKeyManagers( TestKeyStore client, TestKeyStore server, KeyManager[] additionalClientKeyManagers, KeyManager[] additionalServerKeyManagers) { - String protocol = "TLSv1.2"; + String protocol = "TLSv1.3"; KeyManager[] clientKeyManagers = concat(client.keyManagers, additionalClientKeyManagers); KeyManager[] serverKeyManagers = concat(server.keyManagers, additionalServerKeyManagers); SSLContext clientContext =