|
|
335200 |
From 75e4a9eb929520d95cb55b2d850af7ba849fd014 Mon Sep 17 00:00:00 2001
|
|
|
335200 |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
335200 |
Date: Mon, 28 Feb 2022 11:23:55 +0100
|
|
|
335200 |
Subject: [PATCH] Use usedforsecurity=False for md5() calls to make suds work
|
|
|
335200 |
on FIPS enabled systems
|
|
|
335200 |
|
|
|
335200 |
---
|
|
|
335200 |
suds/reader.py | 7 ++++++-
|
|
|
335200 |
suds/wsse.py | 7 ++++++-
|
|
|
335200 |
2 files changed, 12 insertions(+), 2 deletions(-)
|
|
|
335200 |
|
|
|
335200 |
diff --git a/suds/reader.py b/suds/reader.py
|
|
|
335200 |
index 31c5ee7..3354b5d 100644
|
|
|
335200 |
--- a/suds/reader.py
|
|
|
335200 |
+++ b/suds/reader.py
|
|
|
335200 |
@@ -58,7 +58,12 @@ def mangle(self, name, x):
|
|
|
335200 |
@rtype: str
|
|
|
335200 |
|
|
|
335200 |
"""
|
|
|
335200 |
- h = md5(name.encode()).hexdigest()
|
|
|
335200 |
+ try:
|
|
|
335200 |
+ # FIPS requires usedforsecurity=False and might not be
|
|
|
335200 |
+ # available on all distros: https://bugs.python.org/issue9216
|
|
|
335200 |
+ h = md5(name.encode(), usedforsecurity=False).hexdigest()
|
|
|
335200 |
+ except AttributeError:
|
|
|
335200 |
+ h = md5(name.encode()).hexdigest()
|
|
|
335200 |
return '%s-%s' % (h, x)
|
|
|
335200 |
|
|
|
335200 |
|
|
|
335200 |
diff --git a/suds/wsse.py b/suds/wsse.py
|
|
|
335200 |
index 96d9eb6..474d15a 100644
|
|
|
335200 |
--- a/suds/wsse.py
|
|
|
335200 |
+++ b/suds/wsse.py
|
|
|
335200 |
@@ -158,7 +158,12 @@ def setnonce(self, text=None):
|
|
|
335200 |
s.append(self.username)
|
|
|
335200 |
s.append(self.password)
|
|
|
335200 |
s.append(Token.sysdate())
|
|
|
335200 |
- m = md5()
|
|
|
335200 |
+ try:
|
|
|
335200 |
+ # FIPS requires usedforsecurity=False and might not be
|
|
|
335200 |
+ # available on all distros: https://bugs.python.org/issue9216
|
|
|
335200 |
+ m = md5(usedforsecurity=False)
|
|
|
335200 |
+ except AttributeError:
|
|
|
335200 |
+ m = md5()
|
|
|
335200 |
m.update(':'.join(s))
|
|
|
335200 |
self.nonce = m.hexdigest()
|
|
|
335200 |
else:
|