diff options
author | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-10-10 18:13:05 -0400 |
---|---|---|
committer | Dwayne C. Litzenberger <dlitz@dlitz.net> | 2009-10-12 14:53:58 -0400 |
commit | 3d4d4909fb3625ae8746d1b61776b82a0d791150 (patch) | |
tree | 39cf7fd2f881791a3e3bd435ee7bf30f832d6095 /src/block_template.c | |
parent | bfee094ad23cb2406eedc1bbee6c498f40353695 (diff) | |
download | pycrypto-3d4d4909fb3625ae8746d1b61776b82a0d791150.tar.gz |
Check for counter wraparound when encrypting using MODE_CTR
- Add check_wraparound_func pointer to PCT_CounterObject
- Call check_wraparound_func from block_template.c
Diffstat (limited to 'src/block_template.c')
-rw-r--r-- | src/block_template.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/block_template.c b/src/block_template.c index 7548b21..6b9a338 100644 --- a/src/block_template.c +++ b/src/block_template.c @@ -409,6 +409,10 @@ ALG_Encrypt(ALGobject *self, PyObject *args) * and manipulate the counter directly. */ PCT_CounterObject *ctr = (PCT_CounterObject *)(self->counter); + if (!ctr->check_wraparound_func(ctr)) { + free(buffer); + return NULL; + } if (ctr->buf_size != BLOCK_SIZE) { PyErr_Format(PyExc_TypeError, "CTR counter function returned " |