|
|
102e92 |
diff -up yum-3.4.3/yum/Errors.py.orig yum-3.4.3/yum/Errors.py
|
|
|
102e92 |
--- yum-3.4.3/yum/Errors.py.orig 2017-09-14 18:42:26.740558383 +0200
|
|
|
102e92 |
+++ yum-3.4.3/yum/Errors.py 2017-09-14 18:42:30.371541754 +0200
|
|
|
102e92 |
@@ -99,6 +99,11 @@ class ConfigError(YumBaseError):
|
|
|
102e92 |
class MiscError(YumBaseError):
|
|
|
102e92 |
pass
|
|
|
102e92 |
|
|
|
102e92 |
+class FIPSNonCompliantError(MiscError):
|
|
|
102e92 |
+ def __init__(self, sumtype):
|
|
|
102e92 |
+ MiscError.__init__(
|
|
|
102e92 |
+ self, '%s algorithm is not FIPS compliant' % sumtype)
|
|
|
102e92 |
+
|
|
|
102e92 |
class GroupsError(YumBaseError):
|
|
|
102e92 |
pass
|
|
|
102e92 |
|
|
|
102e92 |
diff -up yum-3.4.3/yum/misc.py.orig yum-3.4.3/yum/misc.py
|
|
|
102e92 |
--- yum-3.4.3/yum/misc.py.orig 2017-09-14 18:42:26.794558135 +0200
|
|
|
102e92 |
+++ yum-3.4.3/yum/misc.py 2017-09-14 18:42:30.372541749 +0200
|
|
|
102e92 |
@@ -58,11 +58,20 @@ except ImportError:
|
|
|
102e92 |
raise ValueError, "Bad checksum type"
|
|
|
102e92 |
|
|
|
102e92 |
# some checksum types might be disabled
|
|
|
102e92 |
+_fips_noncompliant = set()
|
|
|
102e92 |
for ctype in list(_available_checksums):
|
|
|
102e92 |
try:
|
|
|
102e92 |
hashlib.new(ctype)
|
|
|
102e92 |
- except:
|
|
|
102e92 |
- print >> sys.stderr, 'Checksum type %s disabled' % repr(ctype)
|
|
|
102e92 |
+ except Exception as e:
|
|
|
102e92 |
+ # Print an error unless this is due to FIPS mode (in which case it's
|
|
|
102e92 |
+ # not really an error and we don't want to pollute the output
|
|
|
102e92 |
+ # needlessly; if someone actually tries to instantiate a Checksum with
|
|
|
102e92 |
+ # a FIPS non-compliant ctype, we'll raise an explanatory exception
|
|
|
102e92 |
+ # anyway).
|
|
|
102e92 |
+ if isinstance(e, ValueError) and str(e).endswith('disabled for fips'):
|
|
|
102e92 |
+ _fips_noncompliant.add(ctype)
|
|
|
102e92 |
+ else:
|
|
|
102e92 |
+ print >> sys.stderr, 'Checksum type %s disabled' % repr(ctype)
|
|
|
102e92 |
_available_checksums.remove(ctype)
|
|
|
102e92 |
for ctype in 'sha256', 'sha1':
|
|
|
102e92 |
if ctype in _available_checksums:
|
|
|
102e92 |
@@ -71,7 +80,7 @@ for ctype in 'sha256', 'sha1':
|
|
|
102e92 |
else:
|
|
|
102e92 |
raise ImportError, 'broken hashlib'
|
|
|
102e92 |
|
|
|
102e92 |
-from Errors import MiscError
|
|
|
102e92 |
+from Errors import MiscError, FIPSNonCompliantError
|
|
|
102e92 |
# These are API things, so we can't remove them even if they aren't used here.
|
|
|
102e92 |
# pylint: disable-msg=W0611
|
|
|
102e92 |
from i18n import to_utf8, to_unicode
|
|
|
102e92 |
@@ -271,6 +280,8 @@ class Checksums:
|
|
|
102e92 |
sumalgo = hashlib.new(sumtype)
|
|
|
102e92 |
elif ignore_missing:
|
|
|
102e92 |
continue
|
|
|
102e92 |
+ elif sumtype in _fips_noncompliant:
|
|
|
102e92 |
+ raise FIPSNonCompliantError(sumtype)
|
|
|
102e92 |
else:
|
|
|
102e92 |
raise MiscError, 'Error Checksumming, bad checksum type %s' % sumtype
|
|
|
102e92 |
done.add(sumtype)
|
|
|
102e92 |
diff -up yum-3.4.3/yum/yumRepo.py.orig yum-3.4.3/yum/yumRepo.py
|
|
|
102e92 |
--- yum-3.4.3/yum/yumRepo.py.orig 2017-09-14 18:42:26.879557746 +0200
|
|
|
102e92 |
+++ yum-3.4.3/yum/yumRepo.py 2017-09-14 18:43:23.422298802 +0200
|
|
|
102e92 |
@@ -497,7 +497,10 @@ class YumRepository(Repository, config.R
|
|
|
102e92 |
except (Errors.MiscError, EnvironmentError), e:
|
|
|
102e92 |
if checksum_can_fail:
|
|
|
102e92 |
return None
|
|
|
102e92 |
- raise Errors.RepoError, 'Error opening file for checksum: %s' % e
|
|
|
102e92 |
+ msg = 'Error opening file for checksum: %s' % e
|
|
|
102e92 |
+ if isinstance(e, Errors.FIPSNonCompliantError):
|
|
|
102e92 |
+ msg = str(e)
|
|
|
102e92 |
+ raise Errors.RepoError(msg)
|
|
|
102e92 |
|
|
|
102e92 |
def dump(self):
|
|
|
102e92 |
output = '[%s]\n' % self.id
|
|
|
102e92 |
@@ -1799,7 +1802,7 @@ Insufficient space in download directory
|
|
|
102e92 |
except Errors.RepoError, e:
|
|
|
102e92 |
if check_can_fail:
|
|
|
102e92 |
return None
|
|
|
102e92 |
- raise URLGrabError(-3, 'Error performing checksum')
|
|
|
102e92 |
+ raise URLGrabError(-3, 'Error performing checksum: %s' % e)
|
|
|
102e92 |
|
|
|
102e92 |
if l_csum == r_csum:
|
|
|
102e92 |
_xattr_set_chksum(file, r_ctype, l_csum)
|