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

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 21, 2022
1 parent 8c9b412 commit d374bb6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/hazmat/primitives/test_ec.py
Expand Up @@ -411,7 +411,7 @@ 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 d374bb6

Please sign in to comment.