]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
buildtools: fixed broken build with FIPS-enabled host
authorShachar Sharon <ssharon@redhat.com>
Thu, 7 Aug 2025 13:42:07 +0000 (16:42 +0300)
committerAnoop C S <anoopcs@samba.org>
Tue, 16 Sep 2025 16:44:31 +0000 (16:44 +0000)
MD5 is not supported on FIPS-enabled machines, but the current
work-around is broken. One the other hand, latest Waf has proper
fixup (use sha1 as a replacement to md5) so there is no need for Samba
specific code.

Tested on CentOS-stream-9 with FIPS (Python-3.9.23).

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
buildtools/wafsamba/samba_utils.py

index 1776fcee96526f22bab9b8d914c988d76997d225..548e21b4a26eddf59c378254f73d1474b478d1f6 100644 (file)
@@ -360,43 +360,6 @@ def RUN_PYTHON_TESTS(testfiles, pythonpath=None, extra_env=None):
     return result
 
 
-# make sure we have md5. some systems don't have it
-try:
-    from hashlib import md5
-    # Even if hashlib.md5 exists, it may be unusable.
-    # Try to use MD5 function. In FIPS mode this will cause an exception
-    # and we'll get to the replacement code
-    foo = md5(b'abcd')
-except:
-    try:
-        import md5
-        # repeat the same check here, mere success of import is not enough.
-        # Try to use MD5 function. In FIPS mode this will cause an exception
-        foo = md5.md5(b'abcd')
-    except:
-        Context.SIG_NIL = hash('abcd')
-        class replace_md5(object):
-            def __init__(self):
-                self.val = None
-            def update(self, val):
-                self.val = hash((self.val, val))
-            def digest(self):
-                return str(self.val)
-            def hexdigest(self):
-                return self.digest().encode('hex')
-        def replace_h_file(filename):
-            f = open(filename, 'rb')
-            m = replace_md5()
-            while (filename):
-                filename = f.read(100000)
-                m.update(filename)
-            f.close()
-            return m.digest()
-        Utils.md5 = replace_md5
-        Task.md5 = replace_md5
-        Utils.h_file = replace_h_file
-
-
 def LOAD_ENVIRONMENT():
     '''load the configuration environment, allowing access to env vars
        from new commands'''