This is an automated email from the ASF dual-hosted git repository.

remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/10.1.x by this push:
     new 131f5a640a Use FFM to get OpenSSL version
131f5a640a is described below

commit 131f5a640a4925f3911c3cf9f54a5efca0843bcf
Author: remm <r...@apache.org>
AuthorDate: Tue Jun 18 13:30:55 2024 +0200

    Use FFM to get OpenSSL version
    
    This should fix the testOpenSSLConfCmdCipher test when tomcat-native is
    not available.
---
 test/org/apache/tomcat/util/net/TesterSupport.java | 15 +++++++++++----
 webapps/docs/changelog.xml                         |  8 ++++++++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/tomcat/util/net/TesterSupport.java 
b/test/org/apache/tomcat/util/net/TesterSupport.java
index f8055d52ca..d663bfe40c 100644
--- a/test/org/apache/tomcat/util/net/TesterSupport.java
+++ b/test/org/apache/tomcat/util/net/TesterSupport.java
@@ -63,6 +63,7 @@ import org.apache.catalina.startup.Tomcat;
 import org.apache.tomcat.jni.Library;
 import org.apache.tomcat.jni.LibraryNotFoundError;
 import org.apache.tomcat.jni.SSL;
+import org.apache.tomcat.util.compat.JreCompat;
 import org.apache.tomcat.util.descriptor.web.LoginConfig;
 import org.apache.tomcat.util.descriptor.web.SecurityCollection;
 import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
@@ -105,10 +106,16 @@ public final class TesterSupport {
         int version = 0;
         String err = "";
         try {
-            Library.initialize(null);
-            available = true;
-            version = SSL.version();
-            Library.terminate();
+            if (JreCompat.isJre22Available()) {
+                // Try with FFM
+                Class<?> openSSL = 
Class.forName("org.apache.tomcat.util.openssl.openssl_h");
+                version = ((Long) 
openSSL.getMethod("OpenSSL_version_num").invoke(null)).intValue();
+            } else {
+                Library.initialize(null);
+                available = true;
+                version = SSL.version();
+                Library.terminate();
+            }
         } catch (Exception | LibraryNotFoundError ex) {
             err = ex.getMessage();
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 707595b761..e52f7d98db 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -105,6 +105,14 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 10.1.26 (schultz)" rtext="in development">
+  <subsection name="Coyote">
+    <changelog>
+      <fix>
+        Clean and log OpenSSL errors before processing of OpenSSL conf commands
+        in the FFM code. (remm)
+      </fix>
+    </changelog>
+  </subsection>
   <subsection name="Jasper">
     <changelog>
       <fix>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to