aboutsummaryrefslogtreecommitdiffstats
path: root/src/cryptography/hazmat/primitives
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2018-07-17 22:56:12 +0800
committerAlex Gaynor <alex.gaynor@gmail.com>2018-07-17 10:56:12 -0400
commit12a1cacb6ae6de51a003dcc884e769854a1345a8 (patch)
tree3efc3e8ca27249f8de685319687bd79bb515c8e5 /src/cryptography/hazmat/primitives
parent7ca0e46d82606b8a12ff323181065a00885d39dc (diff)
downloadcryptography-12a1cacb6ae6de51a003dcc884e769854a1345a8.tar.gz
cryptography-12a1cacb6ae6de51a003dcc884e769854a1345a8.tar.bz2
cryptography-12a1cacb6ae6de51a003dcc884e769854a1345a8.zip
raise ValueError on zero length GCM IV (#4348)
Diffstat (limited to 'src/cryptography/hazmat/primitives')
-rw-r--r--src/cryptography/hazmat/primitives/ciphers/modes.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/primitives/ciphers/modes.py b/src/cryptography/hazmat/primitives/ciphers/modes.py
index 543015fe..e82c1a8d 100644
--- a/src/cryptography/hazmat/primitives/ciphers/modes.py
+++ b/src/cryptography/hazmat/primitives/ciphers/modes.py
@@ -208,6 +208,8 @@ class GCM(object):
# for it
if not isinstance(initialization_vector, bytes):
raise TypeError("initialization_vector must be bytes")
+ if len(initialization_vector) == 0:
+ raise ValueError("initialization_vector must be at least 1 byte")
self._initialization_vector = initialization_vector
if tag is not None:
if not isinstance(tag, bytes):