diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/backend.py | 6 | ||||
-rw-r--r-- | src/cryptography/hazmat/primitives/ciphers/aead.py | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py index c63ea32d..98c79be6 100644 --- a/src/cryptography/hazmat/backends/openssl/backend.py +++ b/src/cryptography/hazmat/backends/openssl/backend.py @@ -1934,7 +1934,11 @@ class Backend(object): self, b"chacha20-poly1305", key, nonce, data, associated_data, 16 ) - def chacha20poly1305_supported(self): + def aead_cipher_supported(self, cls): + from cryptography.hazmat.primitives.ciphers.aead import ( + ChaCha20Poly1305 + ) + assert cls is ChaCha20Poly1305 return ( self._lib.EVP_get_cipherbyname(b"chacha20-poly1305") != self._ffi.NULL diff --git a/src/cryptography/hazmat/primitives/ciphers/aead.py b/src/cryptography/hazmat/primitives/ciphers/aead.py index e89c6979..8b2e20c4 100644 --- a/src/cryptography/hazmat/primitives/ciphers/aead.py +++ b/src/cryptography/hazmat/primitives/ciphers/aead.py @@ -12,7 +12,7 @@ from cryptography.hazmat.backends.openssl.backend import backend class ChaCha20Poly1305(object): def __init__(self, key): - if not backend.chacha20poly1305_supported(): + if not backend.aead_cipher_supported(type(self)): raise exceptions.UnsupportedAlgorithm( "ChaCha20Poly1305 is not supported by this version of OpenSSL", exceptions._Reasons.UNSUPPORTED_CIPHER |