summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDwayne C. Litzenberger <dlitz@dlitz.net>2012-05-24 07:51:41 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2012-05-24 08:44:49 -0400
commit411f60f58cea79f7e93476ba0c069b80a2a4c1a0 (patch)
tree146fc6e92e2b1a12dad03cb9e1f1046821149de0 /src
parentb382f9f9229121054ae6a87678ee3601381de099 (diff)
downloadpycrypto-411f60f58cea79f7e93476ba0c069b80a2a4c1a0.tar.gz
Fix block ciphers allowing empty string as IV
Bug report: https://bugs.launchpad.net/pycrypto/+bug/997464
Diffstat (limited to 'src')
-rw-r--r--src/block_template.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/block_template.c b/src/block_template.c
index bc7aa74..c36b316 100644
--- a/src/block_template.c
+++ b/src/block_template.c
@@ -170,7 +170,7 @@ ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
"Key cannot be the null string");
return NULL;
}
- if (IVlen != BLOCK_SIZE && IVlen != 0)
+ if (IVlen != BLOCK_SIZE && mode != MODE_ECB && mode != MODE_CTR)
{
PyErr_Format(PyExc_ValueError,
"IV must be %i bytes long", BLOCK_SIZE);