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

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


The following commit(s) were added to refs/heads/main by this push:
     new 163786c0db Use FFM to get OpenSSL version
163786c0db is described below

commit 163786c0db798e07b0897f828318ae2ce04a389b
Author: remm <[email protected]>
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                         |  4 ++++
 2 files changed, 15 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 4ab75b9846..7aac4068e6 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -113,6 +113,10 @@
         addresses. Interfaces that are configured for point to point 
connections
         or are not currently up are now skipped. (markt)
       </fix>
+      <fix>
+        Clean and log OpenSSL errors before processing of OpenSSL conf commands
+        in the FFM code. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to