File 0948-crypto-No-md5-in-FIPS-mode-for-ENGINE.patch of Package erlang

From d20ed471ab583fb47c8502a804cf70b9f91d8c3f Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Wed, 30 Mar 2022 07:46:31 +0200
Subject: [PATCH] crypto: No md5 in FIPS mode for ENGINE

---
 lib/crypto/test/engine_SUITE.erl | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/lib/crypto/test/engine_SUITE.erl b/lib/crypto/test/engine_SUITE.erl
index 22c6a033c3..7da6e4e7fb 100644
--- a/lib/crypto/test/engine_SUITE.erl
+++ b/lib/crypto/test/engine_SUITE.erl
@@ -219,18 +219,23 @@ end_per_group(_, Config) ->
 
 %%--------------------------------------------------------------------
 init_per_testcase(Case, Config) ->
-    case string:tokens(atom_to_list(Case),"_") of
-        ["sign","verify",Type|_] ->
-            skip_if_unsup(list_to_atom(Type), Config);
-
-        ["priv","encrypt","pub","decrypt",Type|_] ->
-            skip_if_unsup(list_to_atom(Type), Config);
-
-        ["get","pub","from","priv","key",Type|_] ->
-            skip_if_unsup(list_to_atom(Type), Config);
-
+    HasMD5 = lists:member(md5, crypto:supports(hashs)),
+    case Case of
+        multiple_engine_load     when HasMD5==false -> {skip, "md5 not available"};
+        ensure_load              when HasMD5==false -> {skip, "md5 not available"};
+        engine_load_some_methods when HasMD5==false -> {skip, "md5 not available"};
+        engine_load_all_methods  when HasMD5==false -> {skip, "md5 not available"};
         _ ->
-            Config
+            case string:tokens(atom_to_list(Case),"_") of
+                ["sign","verify",Type|_] ->
+                    skip_if_unsup(list_to_atom(Type), Config);
+                ["priv","encrypt","pub","decrypt",Type|_] ->
+                    skip_if_unsup(list_to_atom(Type), Config);
+                ["get","pub","from","priv","key",Type|_] ->
+                    skip_if_unsup(list_to_atom(Type), Config);
+                _ ->
+                    Config
+            end
     end.
 
 end_per_testcase(_Case, _Config) ->
-- 
2.34.1

openSUSE Build Service is sponsored by