From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 25 Jun 2022 20:45:54 +0000
Subject: [PATCH] gyp-fips

(From Fedora, ported to gyp master)
---
 pylib/gyp/generator/make.py  | 2 +-
 pylib/gyp/generator/ninja.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
index 997eec08666e..06c763db609a 100644
--- a/pylib/gyp/generator/make.py
+++ b/pylib/gyp/generator/make.py
@@ -1774,7 +1774,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
 
       # Hash the target name to avoid generating overlong filenames.
       cmdstring = (command if command else self.target).encode('utf-8')
-      cmddigest = hashlib.sha1(cmdstring).hexdigest()
+      cmddigest = hashlib.sha1(cmdstring, usedforsecurity=False).hexdigest()
       intermediate = "%s.intermediate" % (cmddigest)
       self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
       self.WriteLn('\t%s' % '@:');
diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
index 3bcfe352925b..c439c8b728ad 100644
--- a/pylib/gyp/generator/ninja.py
+++ b/pylib/gyp/generator/ninja.py
@@ -752,7 +752,7 @@ class NinjaWriter(object):
         if self.flavor == 'win':
           # WriteNewNinjaRule uses unique_name for creating an rsp file on win.
           extra_bindings.append(('unique_name',
-              hashlib.md5(six.ensure_binary(outputs[0])).hexdigest()))
+              hashlib.md5(six.ensure_binary(outputs[0]), usedforsecurity=False).hexdigest()))
 
         self.ninja.build(outputs, rule_name, self.GypPathToNinja(source),
                          implicit=inputs,
@@ -2389,7 +2389,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
     qualified_target_for_hash = gyp.common.QualifiedTarget(build_file, name,
                                                            toolset)
     qualified_target_for_hash = qualified_target_for_hash.encode('utf-8')
-    hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest()
+    hash_for_rules = hashlib.md5(qualified_target_for_hash, usedforsecurity=False).hexdigest()
 
     base_path = os.path.dirname(build_file)
     obj = 'obj'
