aboutsummaryrefslogtreecommitdiff
path: root/frozen_deps/Cryptodome/Cipher/_mode_ccm.py
diff options
context:
space:
mode:
Diffstat (limited to 'frozen_deps/Cryptodome/Cipher/_mode_ccm.py')
-rw-r--r--frozen_deps/Cryptodome/Cipher/_mode_ccm.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/frozen_deps/Cryptodome/Cipher/_mode_ccm.py b/frozen_deps/Cryptodome/Cipher/_mode_ccm.py
index 0e1c2f6..ec2e4f4 100644
--- a/frozen_deps/Cryptodome/Cipher/_mode_ccm.py
+++ b/frozen_deps/Cryptodome/Cipher/_mode_ccm.py
@@ -155,8 +155,8 @@ class CcmMode(object):
self._t = None
# Allowed transitions after initialization
- self._next = [self.update, self.encrypt, self.decrypt,
- self.digest, self.verify]
+ self._next = ["update", "encrypt", "decrypt",
+ "digest", "verify"]
# Cumulative lengths
self._cumul_assoc_len = 0
@@ -252,12 +252,12 @@ class CcmMode(object):
A piece of associated data. There are no restrictions on its size.
"""
- if self.update not in self._next:
+ if "update" not in self._next:
raise TypeError("update() can only be called"
" immediately after initialization")
- self._next = [self.update, self.encrypt, self.decrypt,
- self.digest, self.verify]
+ self._next = ["update", "encrypt", "decrypt",
+ "digest", "verify"]
self._cumul_assoc_len += len(assoc_data)
if self._assoc_len is not None and \
@@ -336,10 +336,10 @@ class CcmMode(object):
Otherwise, ``None``.
"""
- if self.encrypt not in self._next:
+ if "encrypt" not in self._next:
raise TypeError("encrypt() can only be called after"
" initialization or an update()")
- self._next = [self.encrypt, self.digest]
+ self._next = ["encrypt", "digest"]
# No more associated data allowed from now
if self._assoc_len is None:
@@ -356,7 +356,7 @@ class CcmMode(object):
if self._msg_len is None:
self._msg_len = len(plaintext)
self._start_mac()
- self._next = [self.digest]
+ self._next = ["digest"]
self._cumul_msg_len += len(plaintext)
if self._cumul_msg_len > self._msg_len:
@@ -409,10 +409,10 @@ class CcmMode(object):
Otherwise, ``None``.
"""
- if self.decrypt not in self._next:
+ if "decrypt" not in self._next:
raise TypeError("decrypt() can only be called"
" after initialization or an update()")
- self._next = [self.decrypt, self.verify]
+ self._next = ["decrypt", "verify"]
# No more associated data allowed from now
if self._assoc_len is None:
@@ -429,7 +429,7 @@ class CcmMode(object):
if self._msg_len is None:
self._msg_len = len(ciphertext)
self._start_mac()
- self._next = [self.verify]
+ self._next = ["verify"]
self._cumul_msg_len += len(ciphertext)
if self._cumul_msg_len > self._msg_len:
@@ -461,10 +461,10 @@ class CcmMode(object):
:Return: the MAC, as a byte string.
"""
- if self.digest not in self._next:
+ if "digest" not in self._next:
raise TypeError("digest() cannot be called when decrypting"
" or validating a message")
- self._next = [self.digest]
+ self._next = ["digest"]
return self._digest()
def _digest(self):
@@ -523,10 +523,10 @@ class CcmMode(object):
or the key is incorrect.
"""
- if self.verify not in self._next:
+ if "verify" not in self._next:
raise TypeError("verify() cannot be called"
" when encrypting a message")
- self._next = [self.verify]
+ self._next = ["verify"]
self._digest()
secret = get_random_bytes(16)