diff --git a/examples/permissive/pom.xml b/examples/permissive/pom.xml
index d8afb1973..fcb87f2a0 100644
--- a/examples/permissive/pom.xml
+++ b/examples/permissive/pom.xml
@@ -121,6 +121,7 @@
true
${graalvmHome}
+ true
diff --git a/examples/strict/pom.xml b/examples/strict/pom.xml
index b67f1bcf5..3cdbc793a 100644
--- a/examples/strict/pom.xml
+++ b/examples/strict/pom.xml
@@ -187,6 +187,7 @@
true
-->
${graalvmHome}
+ true
diff --git a/maven/src/main/java/org/jboss/shamrock/maven/NativeImageMojo.java b/maven/src/main/java/org/jboss/shamrock/maven/NativeImageMojo.java
index 654d45a81..f60365d95 100644
--- a/maven/src/main/java/org/jboss/shamrock/maven/NativeImageMojo.java
+++ b/maven/src/main/java/org/jboss/shamrock/maven/NativeImageMojo.java
@@ -60,6 +60,9 @@ public class NativeImageMojo extends AbstractMojo {
@Parameter(defaultValue = "false")
private boolean enableServer;
+ @Parameter(defaultValue = "false")
+ private boolean enableJni;
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
@@ -114,6 +117,9 @@ public class NativeImageMojo extends AbstractMojo {
if (enableCodeSizeReporting) {
command.add("-H:+PrintCodeSizeReport");
}
+ if (enableJni) {
+ command.add("-H:+JNI");
+ }
if(!enableServer) {
command.add("--no-server");
}
diff --git a/pom.xml b/pom.xml
index 4190770ce..3df8219ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,7 +57,7 @@
2.2
2.1.12
1.0
-
+ 1.0.6.Final
${env.GRAALVM_HOME}
@@ -597,6 +597,17 @@
${xnio.version}
+
+ org.wildfly.openssl
+ wildfly-openssl-java
+ ${wildfly.openssl.version}
+
+
+ org.wildfly.openssl
+ wildfly-openssl-linux-x86_64
+ ${wildfly.openssl.version}
+
+
org.ow2.asm
asm
diff --git a/undertow/runtime/pom.xml b/undertow/runtime/pom.xml
index 5bb7b189a..7f98ee0f1 100644
--- a/undertow/runtime/pom.xml
+++ b/undertow/runtime/pom.xml
@@ -25,6 +25,14 @@
org.jboss.xnio
xnio-nio
+
+ org.wildfly.openssl
+ wildfly-openssl-java
+
+
+ org.wildfly.openssl
+ wildfly-openssl-linux-x86_64
+
org.jboss.shamrock
diff --git a/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/ALPNManagerSubstitution.java b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/ALPNManagerSubstitution.java
index af28579f3..4dfdc9af0 100644
--- a/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/ALPNManagerSubstitution.java
+++ b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/ALPNManagerSubstitution.java
@@ -5,12 +5,13 @@ import javax.net.ssl.SSLEngine;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import io.undertow.protocols.alpn.ALPNProvider;
+import io.undertow.protocols.alpn.OpenSSLAlpnProvider;
@TargetClass(className = "io.undertow.protocols.alpn.ALPNManager")
public final class ALPNManagerSubstitution {
@Substitute
public ALPNProvider getProvider(SSLEngine engine) {
- return null;
+ return new OpenSSLAlpnProvider();
}
}
diff --git a/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLContextSubstitution.java b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLContextSubstitution.java
new file mode 100644
index 000000000..d0644d3a9
--- /dev/null
+++ b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLContextSubstitution.java
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2018 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.shamrock.undertow.runtime.graal;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.util.Objects;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLContextSpi;
+import javax.net.ssl.SSLException;
+
+import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.wildfly.openssl.OpenSSLContextSPI;
+import org.wildfly.openssl.OpenSSLProvider;
+
+/**
+ */
+@TargetClass(SSLContext.class)
+public final class SSLContextSubstitution {
+
+ @Alias
+ SSLContextSubstitution(SSLContextSpi var1, Provider var2, String var3) {
+ // empty
+ }
+
+ @Substitute
+ public static SSLContext getInstance(String protocol) throws NoSuchAlgorithmException {
+ return (SSLContext) (Object) new SSLContextSubstitution(Utils.getSpi(protocol), OpenSSLProvider.INSTANCE, protocol);
+ }
+
+ @Substitute
+ public static SSLContext getInstance(String protocol, String provider) throws NoSuchAlgorithmException, NoSuchProviderException {
+ if (provider.equals("OpenSSL")) {
+ return getInstance(protocol);
+ } else {
+ throw new NoSuchProviderException(provider);
+ }
+ }
+
+ @Substitute
+ public static SSLContext getInstance(String protocol, Provider provider) throws NoSuchAlgorithmException {
+ if (provider instanceof OpenSSLProvider) {
+ return (SSLContext) (Object) new SSLContextSubstitution(Utils.getSpi(protocol), provider, protocol);
+ } else {
+ throw new NoSuchAlgorithmException(protocol);
+ }
+ }
+
+ static final class Utils {
+ static SSLContextSpi getSpi(String protocol) throws NoSuchAlgorithmException {
+ Objects.requireNonNull(protocol, "null protocol name");
+ try {
+ if ("TLS".equals(protocol) || "Default".equals(protocol)) {
+ return new OpenSSLContextSPI.OpenSSLTLSContextSpi();
+ } else if ("TLSv1.0".equals(protocol)) {
+ return new OpenSSLContextSPI.OpenSSLTLS_1_0_ContextSpi();
+ } else if ("TLSv1.1".equals(protocol)) {
+ return new OpenSSLContextSPI.OpenSSLTLS_1_1_ContextSpi();
+ } else if ("TLSv1.2".equals(protocol)) {
+ return new OpenSSLContextSPI.OpenSSLTLS_1_1_ContextSpi();
+ } else {
+ throw new NoSuchAlgorithmException(protocol);
+ }
+ } catch (SSLException e) {
+ throw new NoSuchAlgorithmException(e);
+ }
+ }
+ }
+}
+
diff --git a/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLSubstitution.java b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLSubstitution.java
new file mode 100644
index 000000000..138776d99
--- /dev/null
+++ b/undertow/runtime/src/main/java/org/jboss/shamrock/undertow/runtime/graal/SSLSubstitution.java
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2018 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.shamrock.undertow.runtime.graal;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.wildfly.openssl.SSL;
+
+/**
+ */
+@TargetClass(SSL.class)
+public final class SSLSubstitution {
+
+
+ @Substitute
+ static void init() {
+ System.loadLibrary("wfssl");
+ }
+}