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 3b616b23d2 69607: Allow failed initialization of MD5
3b616b23d2 is described below

commit 3b616b23d285c78ce7fdf8bac57aadb7f3688576
Author: remm <r...@apache.org>
AuthorDate: Tue Mar 11 22:47:29 2025 +0100

    69607: Allow failed initialization of MD5
    
    Based on code submitted by Shivam Verma
---
 .../apache/tomcat/util/security/ConcurrentMessageDigest.java  | 11 +++++++++--
 webapps/docs/changelog.xml                                    |  4 ++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java 
b/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java
index c59a0fe8ea..45dc4ae48c 100644
--- a/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java
+++ b/java/org/apache/tomcat/util/security/ConcurrentMessageDigest.java
@@ -23,6 +23,8 @@ import java.util.Queue;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
@@ -33,6 +35,7 @@ import org.apache.tomcat.util.res.StringManager;
 public class ConcurrentMessageDigest {
 
     private static final StringManager sm = 
StringManager.getManager(ConcurrentMessageDigest.class);
+    private static final Log log = 
LogFactory.getLog(ConcurrentMessageDigest.class);
 
     private static final String MD5 = "MD5";
     private static final String SHA1 = "SHA-1";
@@ -46,10 +49,14 @@ public class ConcurrentMessageDigest {
     }
 
     static {
+        // Init commonly used algorithms
         try {
-            // Init commonly used algorithms
             init(MD5);
-            init(SHA1);
+        } catch (NoSuchAlgorithmException e) {
+            log.warn(sm.getString("concurrentMessageDigest.noDigest"), e);
+        }
+        try {
+           init(SHA1);
         } catch (NoSuchAlgorithmException e) {
             throw new 
IllegalArgumentException(sm.getString("concurrentMessageDigest.noDigest"), e);
         }
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 8891a76fe1..2ea3887316 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -180,6 +180,10 @@
         (remm)
       </update>
       <!-- Entries for backport and removal before 12.0.0-M1 below this line 
-->
+      <fix>
+        <bug>69607</bug>: Allow failed initialization of MD5. Based on code
+        submitted by Shivam Verma. (remm)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


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

Reply via email to