diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml index 34da49a2f9..c9fde9292a 100644 --- a/.github/workflows/ci-pr.yml +++ b/.github/workflows/ci-pr.yml @@ -70,8 +70,10 @@ jobs: # Compile native code and the modules it depend on and run NativeLoadingTest. This is enough to ensure # we can load the native module on aarch64 + # + # Use tcnative.classifier that is empty as we don't support using the shared lib version on ubuntu. run: | - JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64 mvn -pl testsuite-native -am clean package -DskipTests=true -Dcheckstyle.skip=true -DskipNativeTestsuite=false + JAVA_HOME=/usr/lib/jvm/java-11-openjdk-arm64 mvn -pl testsuite-native -am clean package -DskipTests=true -Dcheckstyle.skip=true -DskipNativeTestsuite=false -Dtcnative.classifier= build-pr: runs-on: ubuntu-latest diff --git a/handler/src/main/java/io/netty/handler/ssl/OpenSsl.java b/handler/src/main/java/io/netty/handler/ssl/OpenSsl.java index 0154946494..3151b2fa7b 100644 --- a/handler/src/main/java/io/netty/handler/ssl/OpenSsl.java +++ b/handler/src/main/java/io/netty/handler/ssl/OpenSsl.java @@ -358,6 +358,10 @@ public final class OpenSsl { } } + static boolean isSessionCacheSupported() { + return version() >= 0x10100000L; + } + /** * Returns a self-signed {@link X509Certificate} for {@code netty.io}. */ diff --git a/handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java b/handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java index f577051084..8326a4f83f 100644 --- a/handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/CloseNotifyTest.java @@ -82,6 +82,10 @@ public class CloseNotifyTest { public void eventsOrder() throws Exception { assumeTrue("OpenSSL is not available", provider != SslProvider.OPENSSL || OpenSsl.isAvailable()); + if (PROTOCOL_TLS_V1_3.equals(protocol)) { + // Ensure we support TLSv1.3 + assumeTrue(SslProvider.isTlsv13Supported(provider)); + } BlockingQueue clientEventQueue = new LinkedBlockingQueue(); BlockingQueue serverEventQueue = new LinkedBlockingQueue(); diff --git a/handler/src/test/java/io/netty/handler/ssl/ConscryptOpenSslEngineInteropTest.java b/handler/src/test/java/io/netty/handler/ssl/ConscryptOpenSslEngineInteropTest.java index 893a61a4fa..7a13f9a478 100644 --- a/handler/src/test/java/io/netty/handler/ssl/ConscryptOpenSslEngineInteropTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/ConscryptOpenSslEngineInteropTest.java @@ -151,11 +151,40 @@ public class ConscryptOpenSslEngineInteropTest extends ConscryptSslEngineTest { super.testSessionLocalWhenNonMutualWithKeyManager(); } + @Override + public void testSessionLocalWhenNonMutualWithoutKeyManager() throws Exception { + // This only really works when the KeyManagerFactory is supported as otherwise we not really know when + // we need to provide a cert. + assumeTrue(OpenSsl.supportsKeyManagerFactory()); + super.testSessionLocalWhenNonMutualWithoutKeyManager(); + } + @Override protected void invalidateSessionsAndAssert(SSLSessionContext context) { // Not supported by conscrypt } + @Override + @Test + public void testSessionCache() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCache(); + } + + @Override + @Test + public void testSessionCacheTimeout() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheTimeout(); + } + + @Override + @Test + public void testSessionCacheSize() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheSize(); + } + @Override protected SSLEngine wrapEngine(SSLEngine engine) { return Java8SslTestUtils.wrapSSLEngineForTesting(engine); diff --git a/handler/src/test/java/io/netty/handler/ssl/JdkOpenSslEngineInteroptTest.java b/handler/src/test/java/io/netty/handler/ssl/JdkOpenSslEngineInteroptTest.java index 3f1fb5625f..b3dd79ebcf 100644 --- a/handler/src/test/java/io/netty/handler/ssl/JdkOpenSslEngineInteroptTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/JdkOpenSslEngineInteroptTest.java @@ -157,6 +157,35 @@ public class JdkOpenSslEngineInteroptTest extends SSLEngineTest { super.testSessionLocalWhenNonMutualWithKeyManager(); } + @Override + public void testSessionLocalWhenNonMutualWithoutKeyManager() throws Exception { + // This only really works when the KeyManagerFactory is supported as otherwise we not really know when + // we need to provide a cert. + assumeTrue(OpenSsl.supportsKeyManagerFactory()); + super.testSessionLocalWhenNonMutualWithoutKeyManager(); + } + + @Override + @Test + public void testSessionCache() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCache(); + } + + @Override + @Test + public void testSessionCacheTimeout() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheTimeout(); + } + + @Override + @Test + public void testSessionCacheSize() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheSize(); + } + @Override protected SSLEngine wrapEngine(SSLEngine engine) { return Java8SslTestUtils.wrapSSLEngineForTesting(engine); diff --git a/handler/src/test/java/io/netty/handler/ssl/OpenSslConscryptSslEngineInteropTest.java b/handler/src/test/java/io/netty/handler/ssl/OpenSslConscryptSslEngineInteropTest.java index 9690765622..0db6dbc174 100644 --- a/handler/src/test/java/io/netty/handler/ssl/OpenSslConscryptSslEngineInteropTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/OpenSslConscryptSslEngineInteropTest.java @@ -143,6 +143,27 @@ public class OpenSslConscryptSslEngineInteropTest extends ConscryptSslEngineTest super.testSessionLocalWhenNonMutualWithKeyManager(); } + @Override + @Test + public void testSessionCache() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCache(); + } + + @Override + @Test + public void testSessionCacheTimeout() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheTimeout(); + } + + @Override + @Test + public void testSessionCacheSize() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheSize(); + } + @Override protected void invalidateSessionsAndAssert(SSLSessionContext context) { // Not supported by conscrypt diff --git a/handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java b/handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java index ed77854224..a87f2a61fe 100644 --- a/handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/OpenSslEngineTest.java @@ -1380,6 +1380,14 @@ public class OpenSslEngineTest extends SSLEngineTest { super.testSessionLocalWhenNonMutualWithKeyManager(); } + @Override + public void testSessionLocalWhenNonMutualWithoutKeyManager() throws Exception { + // This only really works when the KeyManagerFactory is supported as otherwise we not really know when + // we need to provide a cert. + assumeTrue(OpenSsl.supportsKeyManagerFactory()); + super.testSessionLocalWhenNonMutualWithoutKeyManager(); + } + @Override protected SslProvider sslClientProvider() { return SslProvider.OPENSSL; @@ -1421,14 +1429,29 @@ public class OpenSslEngineTest extends SSLEngineTest { return context; } - @Test @Override + @Test public void testSessionCache() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); super.testSessionCache(); assertSessionContext(clientSslCtx); assertSessionContext(serverSslCtx); } + @Override + @Test + public void testSessionCacheTimeout() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheTimeout(); + } + + @Override + @Test + public void testSessionCacheSize() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheSize(); + } + private static void assertSessionContext(SslContext context) { if (context == null) { return; diff --git a/handler/src/test/java/io/netty/handler/ssl/OpenSslJdkSslEngineInteroptTest.java b/handler/src/test/java/io/netty/handler/ssl/OpenSslJdkSslEngineInteroptTest.java index 9aa548630b..0e12ed91a1 100644 --- a/handler/src/test/java/io/netty/handler/ssl/OpenSslJdkSslEngineInteroptTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/OpenSslJdkSslEngineInteroptTest.java @@ -142,6 +142,35 @@ public class OpenSslJdkSslEngineInteroptTest extends SSLEngineTest { super.testSessionLocalWhenNonMutualWithKeyManager(); } + @Override + public void testSessionLocalWhenNonMutualWithoutKeyManager() throws Exception { + // This only really works when the KeyManagerFactory is supported as otherwise we not really know when + // we need to provide a cert. + assumeTrue(OpenSsl.supportsKeyManagerFactory()); + super.testSessionLocalWhenNonMutualWithoutKeyManager(); + } + + @Override + @Test + public void testSessionCache() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCache(); + } + + @Override + @Test + public void testSessionCacheTimeout() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheTimeout(); + } + + @Override + @Test + public void testSessionCacheSize() throws Exception { + assumeTrue(OpenSsl.isSessionCacheSupported()); + super.testSessionCacheSize(); + } + @Override protected SSLEngine wrapEngine(SSLEngine engine) { return Java8SslTestUtils.wrapSSLEngineForTesting(engine); diff --git a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java index ea30b873d1..91716e44c3 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SSLEngineTest.java @@ -536,6 +536,7 @@ public abstract class SSLEngineTest { @Test(expected = SSLHandshakeException.class) public void testIncompatibleCiphers() throws Exception { assumeTrue(SslProvider.isTlsv13Supported(sslClientProvider())); + assumeTrue(SslProvider.isTlsv13Supported(sslServerProvider())); SelfSignedCertificate ssc = new SelfSignedCertificate(); // Select a mandatory cipher from the TLSv1.2 RFC https://www.ietf.org/rfc/rfc5246.txt so handshakes won't fail diff --git a/handler/src/test/java/io/netty/handler/ssl/SslContextBuilderTest.java b/handler/src/test/java/io/netty/handler/ssl/SslContextBuilderTest.java index 5ee3f2c7cc..d2c4cff450 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SslContextBuilderTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SslContextBuilderTest.java @@ -102,6 +102,7 @@ public class SslContextBuilderTest { @Test public void testContextFromManagersOpenssl() throws Exception { Assume.assumeTrue(OpenSsl.isAvailable()); + Assume.assumeTrue(OpenSsl.supportsKeyManagerFactory()); testContextFromManagers(SslProvider.OPENSSL); } diff --git a/pom.xml b/pom.xml index 7e8cab72ec..bf5f97eeec 100644 --- a/pom.xml +++ b/pom.xml @@ -68,20 +68,6 @@ - - not_x86_64 - - - !x86_64 - - - - - - true - - - graal @@ -333,7 +319,7 @@ fedora,suse,arch netty-tcnative - 2.0.38.Final + 2.0.39.Final ${os.detected.classifier} org.conscrypt conscrypt-openjdk-uber