Skip to content

Commit 7623e4e

Browse files
committed
Handle diferent error code for AWS-LC in SPKI distrust test
1 parent 3acc941 commit 7623e4e

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎Lib/test/test_ssl.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2801,8 +2801,14 @@ def test_distrusted_spki(self):
28012801
with self.assertRaises(ssl.SSLCertVerificationError) as cm:
28022802
connected_bio_pair(client_context, server_context,
28032803
DISTRUSTED_SPKI_HOSTNAME)
2804-
# X509_V_ERR_CERT_REJECTED
2805-
self.assertEqual(cm.exception.verify_code, 28)
2804+
if IS_AWS_LC:
2805+
# gh-160736: AWS-LC has its own SPKI denylist. It fails the
2806+
# chain before _ssl's verify callback sees the certificate,
2807+
# so the library's error is kept: X509_V_ERR_CERT_REVOKED.
2808+
self.assertEqual(cm.exception.verify_code, 23)
2809+
else:
2810+
# Rejected by _ssl's verify callback: X509_V_ERR_CERT_REJECTED
2811+
self.assertEqual(cm.exception.verify_code, 28)
28062812

28072813
def test_sni_callback_context_released_and_callback_raises(self):
28082814
# Variant of the test below without a HelloRetryRequest: the callback

0 commit comments

Comments
 (0)