a wrapper ignoring FIPS for hashlib.md5

This commit is contained in:
Yu Ming Zhu 2020-06-16 11:55:39 +00:00 committed by Tomas Kopecek
parent 0a61104280
commit a893e8bf2b
9 changed files with 29 additions and 19 deletions

View file

@ -45,6 +45,17 @@ import koji
from koji.xmlrpcplus import DateTime
# BEGIN kojikamid dup #
def md5_constructor(*args, **kwargs):
if hasattr(hashlib._hashlib, 'get_fips_mode') and hashlib._hashlib.get_fips_mode():
# do not care about FIPS
kwargs['usedforsecurity'] = False
return hashlib.md5(*args, **kwargs)
# END kojikamid dup #
# imported from kojiweb and kojihub
def deprecated(message):
"""Print deprecation warning"""
@ -583,7 +594,7 @@ def check_sigmd5(filename):
f.seek(o)
# compute md5 of rest of file
md5 = hashlib.md5()
md5 = md5_constructor()
while True:
d = f.read(1024**2)
if not d: