From a8b35f4a882ddd02fefed69163e9f226eab99ce9 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sun, 24 Nov 2013 11:51:22 -0600 Subject: make _CipherContext in backend.py compliant with AEADCipherContext * Might make more sense to split it into _CipherContext and _AEADCipherContext like we do in base.py, but there would be quite a bit of duplicate code. --- cryptography/hazmat/bindings/openssl/backend.py | 5 +++++ cryptography/hazmat/primitives/ciphers/base.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/openssl/backend.py b/cryptography/hazmat/bindings/openssl/backend.py index 1a534011..4d9a8ce5 100644 --- a/cryptography/hazmat/bindings/openssl/backend.py +++ b/cryptography/hazmat/bindings/openssl/backend.py @@ -237,6 +237,7 @@ class GetCipherByName(object): @utils.register_interface(interfaces.CipherContext) +@utils.register_interface(interfaces.AEADCipherContext) class _CipherContext(object): _ENCRYPT = 1 _DECRYPT = 0 @@ -343,6 +344,10 @@ class _CipherContext(object): ) assert res != 0 + @property + def tag(self): + return self._tag + @utils.register_interface(interfaces.HashContext) class _HashContext(object): diff --git a/cryptography/hazmat/primitives/ciphers/base.py b/cryptography/hazmat/primitives/ciphers/base.py index 252a9feb..a6f06b82 100644 --- a/cryptography/hazmat/primitives/ciphers/base.py +++ b/cryptography/hazmat/primitives/ciphers/base.py @@ -85,7 +85,7 @@ class _AEADCipherContext(object): if self._ctx is None: raise AlreadyFinalized("Context was already finalized") data = self._ctx.finalize() - self._tag = self._ctx._tag + self._tag = self._ctx.tag self._ctx = None return data -- cgit v1.2.3