aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-05-16 11:37:29 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-05-16 11:37:29 -0400
commit18e17c6701c66481d09ed01697e3ec42ec3b73c7 (patch)
tree96c5fb578b9732356c5db5b6e4e5ae149282d071
parent4892e60ab1b11181a2b573968e6fbaf0a03609f8 (diff)
downloadcryptography-18e17c6701c66481d09ed01697e3ec42ec3b73c7.tar.gz
cryptography-18e17c6701c66481d09ed01697e3ec42ec3b73c7.tar.bz2
cryptography-18e17c6701c66481d09ed01697e3ec42ec3b73c7.zip
Fix
-rw-r--r--cryptography/hazmat/primitives/ciphers/modes.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/cryptography/hazmat/primitives/ciphers/modes.py b/cryptography/hazmat/primitives/ciphers/modes.py
index 96b07ce1..20dab8ae 100644
--- a/cryptography/hazmat/primitives/ciphers/modes.py
+++ b/cryptography/hazmat/primitives/ciphers/modes.py
@@ -84,7 +84,11 @@ class CTR(object):
def __init__(self, nonce):
self.nonce = nonce
- validate_for_algorithm = _check_iv_length
+ def validate_for_algorithm(self, algorithm):
+ if len(self.nonce) * 8 != algorithm.block_size:
+ raise ValueError("Invalid nonce size ({0}) for {1}".format(
+ len(self.nonce), self.name
+ ))
@utils.register_interface(interfaces.Mode)