1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
3 Date: Sat, 25 Jun 2022 20:45:54 +0000
4 Subject: [PATCH] gyp-fips
6 (From Fedora, ported to gyp master)
8 pylib/gyp/generator/make.py | 2 +-
9 pylib/gyp/generator/ninja.py | 4 ++--
10 2 files changed, 3 insertions(+), 3 deletions(-)
12 diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py
13 index 997eec08666e..06c763db609a 100644
14 --- a/pylib/gyp/generator/make.py
15 +++ b/pylib/gyp/generator/make.py
16 @@ -1774,7 +1774,7 @@ $(obj).$(TOOLSET)/$(TARGET)/%%.o: $(obj)/%%%s FORCE_DO_CMD
18 # Hash the target name to avoid generating overlong filenames.
19 cmdstring = (command if command else self.target).encode('utf-8')
20 - cmddigest = hashlib.sha1(cmdstring).hexdigest()
21 + cmddigest = hashlib.sha1(cmdstring, usedforsecurity=False).hexdigest()
22 intermediate = "%s.intermediate" % (cmddigest)
23 self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
24 self.WriteLn('\t%s' % '@:');
25 diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py
26 index 3bcfe352925b..c439c8b728ad 100644
27 --- a/pylib/gyp/generator/ninja.py
28 +++ b/pylib/gyp/generator/ninja.py
29 @@ -752,7 +752,7 @@ class NinjaWriter(object):
30 if self.flavor == 'win':
31 # WriteNewNinjaRule uses unique_name for creating an rsp file on win.
32 extra_bindings.append(('unique_name',
33 - hashlib.md5(six.ensure_binary(outputs[0])).hexdigest()))
34 + hashlib.md5(six.ensure_binary(outputs[0]), usedforsecurity=False).hexdigest()))
36 self.ninja.build(outputs, rule_name, self.GypPathToNinja(source),
38 @@ -2389,7 +2389,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
39 qualified_target_for_hash = gyp.common.QualifiedTarget(build_file, name,
41 qualified_target_for_hash = qualified_target_for_hash.encode('utf-8')
42 - hash_for_rules = hashlib.md5(qualified_target_for_hash).hexdigest()
43 + hash_for_rules = hashlib.md5(qualified_target_for_hash, usedforsecurity=False).hexdigest()
45 base_path = os.path.dirname(build_file)