diff options
author | Adam Vartanian <flooey@google.com> | 2019-01-15 13:49:07 +0000 |
---|---|---|
committer | Adam Vartanian <flooey@google.com> | 2019-01-15 13:49:07 +0000 |
commit | d7e7f44477c7a0202af91db3331cdcd15ef00e42 (patch) | |
tree | 75d3aea8b4087f21165f7ed1ecc464de95577333 /harmony-tests | |
parent | 9cf3051bc756fa7aa2f31a3c365aca8d3fb1830b (diff) |
Update tests for TLS 1.3 by default
Fix tests that excluded TLS 1.3 cipher suites from the list of suites
expected to be enabled.
Also remove one test that assumed key exchange mechanisms must be part
of the cipher suite names. TLS 1.3 cipher suites do not include the
key exchange mechanism, which is negotiated separately.
Test: cts -m CtsLibcoreTestCases
Change-Id: I99509c3c813a16b045629acc1c861fa06c077ca8
Diffstat (limited to 'harmony-tests')
4 files changed, 3 insertions, 39 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java index 930fa3fb05..47ddb853ed 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLEngineTest.java @@ -64,10 +64,7 @@ public class SSLEngineTest extends TestCase { assertEquals(-1, e.getPeerPort()); String[] suites = e.getSupportedCipherSuites(); e.setEnabledCipherSuites(suites); - // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites - // shouldn't be enabled. - assertEquals(suites.length - StandardNames.CIPHER_SUITES_TLS13.size(), - e.getEnabledCipherSuites().length); + assertEquals(suites.length, e.getEnabledCipherSuites().length); } /** @@ -104,10 +101,7 @@ public class SSLEngineTest extends TestCase { assertEquals(e.getPeerPort(), port); String[] suites = e.getSupportedCipherSuites(); e.setEnabledCipherSuites(suites); - // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites - // shouldn't be enabled. - assertEquals(suites.length - StandardNames.CIPHER_SUITES_TLS13.size(), - e.getEnabledCipherSuites().length); + assertEquals(suites.length, e.getEnabledCipherSuites().length); e.setUseClientMode(true); assertTrue(e.getUseClientMode()); } @@ -184,10 +178,7 @@ public class SSLEngineTest extends TestCase { sse.setEnabledCipherSuites(st); String[] res = sse.getEnabledCipherSuites(); assertNotNull("Null array was returned", res); - // By default, the engine only supports TLS 1.2, so the TLS 1.3 cipher suites - // shouldn't be enabled. List<String> supported = new ArrayList<>(Arrays.asList(st)); - supported.removeAll(StandardNames.CIPHER_SUITES_TLS13); assertEquals("Incorrect array length", res.length, supported.size()); assertEquals("Incorrect array was returned", Arrays.asList(res), supported); diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java index 247b4e43e8..c61a13bf82 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLServerSocketTest.java @@ -229,10 +229,7 @@ public class SSLServerSocketTest extends TestCase { sss.setEnabledCipherSuites(sss.getSupportedCipherSuites()); String[] res = sss.getEnabledCipherSuites(); assertNotNull("NULL result", res); - // By default, the socket only supports TLS 1.2, so the TLS 1.3 cipher suites - // shouldn't be enabled. List<String> supported = new ArrayList<>(Arrays.asList(sss.getSupportedCipherSuites())); - supported.removeAll(StandardNames.CIPHER_SUITES_TLS13); assertEquals("not all supported cipher suites were enabled", supported, Arrays.asList(res)); diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java index 978f20b89e..fe8a7723b7 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSessionTest.java @@ -91,27 +91,6 @@ public class SSLSessionTest extends TestCase { } /** - * javax.net.ssl.SSLSession#getCipherSuite() - */ - public void test_getCipherSuite() { - // Identify the expected cipher suite from the expected list of cipher suites enabled by - // default. - // This test class initializes the server with an RSA key. Thus, only cipher suites that - // authenticate the server using RSA are expected to be used. - String expectedCipherSuite = null; - for (String cipherSuite : StandardNames.CIPHER_SUITES_DEFAULT) { - if (cipherSuite.contains("_RSA_")) { - expectedCipherSuite = cipherSuite; - break; - } - } - if (expectedCipherSuite == null) { - fail("Failed to identify expected cipher suite"); - } - assertEquals(expectedCipherSuite, clientSession.getCipherSuite()); - } - - /** * javax.net.ssl.SSLSession#getCreationTime() */ public void test_getCreationTime() { @@ -184,7 +163,7 @@ public class SSLSessionTest extends TestCase { * javax.net.ssl.SSLSession#getProtocol() */ public void test_getProtocol() { - assertEquals("TLSv1.2", clientSession.getProtocol()); + assertEquals("TLSv1.3", clientSession.getProtocol()); } /** diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java index d30ae53a6b..c23b56b8a1 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/SSLSocketTest.java @@ -373,10 +373,7 @@ public class SSLSocketTest extends TestCase { ssl.setEnabledCipherSuites(ssl.getSupportedCipherSuites()); String[] res = ssl.getEnabledCipherSuites(); assertNotNull("NULL result", res); - // By default, the socket only supports TLS 1.2, so the TLS 1.3 cipher suites - // shouldn't be enabled. List<String> supported = new ArrayList<>(Arrays.asList(ssl.getSupportedCipherSuites())); - supported.removeAll(StandardNames.CIPHER_SUITES_TLS13); assertEquals("not all supported cipher suites were enabled", supported, Arrays.asList(res)); |