bpo-40479: Fix hashlib's usedforsecurity for OpenSSL 3.0.0 (GH-30455) by tiran · Pull Request #30455 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix tests, need to check for openssl digest
  • Loading branch information
tiran committed Jan 7, 2022
commit 487becdac0fe866d319b3a545ab653ff4a101b08
2 changes: 1 addition & 1 deletion Lib/test/test_hashlib.py
6 changes: 3 additions & 3 deletions Lib/test/test_imaplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def cmd_AUTHENTICATE(self, tag, args):
self.assertEqual(code, 'OK')
self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake'

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def test_login_cram_md5_bytes(self):
class AuthHandler(SimpleIMAPHandler):
capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
Expand All @@ -405,7 +405,7 @@ def cmd_AUTHENTICATE(self, tag, args):
ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf")
self.assertEqual(ret, "OK")

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def test_login_cram_md5_plain_text(self):
class AuthHandler(SimpleIMAPHandler):
capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
Expand Down Expand Up @@ -851,7 +851,7 @@ def cmd_AUTHENTICATE(self, tag, args):
b'ZmFrZQ==\r\n') # b64 encoded 'fake'

@threading_helper.reap_threads
@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def test_login_cram_md5(self):

class AuthHandler(SimpleIMAPHandler):
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_poplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ def test_noop(self):
def test_rpop(self):
self.assertOK(self.client.rpop('foo'))

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def test_apop_normal(self):
self.assertOK(self.client.apop('foo', 'dummypassword'))

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def test_apop_REDOS(self):
# Replace welcome with very long evil welcome.
# NB The upper bound on welcome length is currently 2048.
Expand Down
4 changes: 2 additions & 2 deletions Lib/test/test_smtplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1171,7 +1171,7 @@ def auth_buggy(challenge=None):
finally:
smtp.close()

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def testAUTH_CRAM_MD5(self):
self.serv.add_feature("AUTH CRAM-MD5")
smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
Expand All @@ -1180,7 +1180,7 @@ def testAUTH_CRAM_MD5(self):
self.assertEqual(resp, (235, b'Authentication Succeeded'))
smtp.close()

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
def testAUTH_multiple(self):
# Test that multiple authentication methods are tried.
self.serv.add_feature("AUTH BOGUS PLAIN LOGIN CRAM-MD5")
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_tools/test_md5sum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

skip_if_missing()

@hashlib_helper.requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5', openssl=True)
class MD5SumTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_urllib2_localnet.py