Skip to content

Commit

Permalink
Update invalid EC key test for compatibility with upcoming OpenSSL ch…
Browse files Browse the repository at this point in the history
…anges (#7833)

One of the tests checking behavior with invalid EC keys hardcoded the
error reason.

This commit replaces the string matching with a regex to match both the
current string and a new reason, introduced by upcoming OpenSSL
changes [0], which would otherwise trigger a false positive failure.

[0]: openssl/openssl#19681
  • Loading branch information
romen committed Nov 27, 2022
1 parent fe5442c commit 884c2cb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/hazmat/primitives/test_ec.py
Expand Up @@ -411,7 +411,9 @@ def test_load_invalid_ec_key_from_pem(self, backend):
# BoringSSL rejects infinity points before it ever gets to us, so it
# uses a more generic error message.
match = (
"infinity" if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL else None
r"infinity|invalid form"
if not backend._lib.CRYPTOGRAPHY_IS_BORINGSSL
else None
)
with pytest.raises(ValueError, match=match):
serialization.load_pem_public_key(
Expand Down

0 comments on commit 884c2cb

Please sign in to comment.