summaryrefslogtreecommitdiff
path: root/src/block_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/block_template.c')
-rw-r--r--src/block_template.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/block_template.c b/src/block_template.c
index 3526cd1..bc7aa74 100644
--- a/src/block_template.c
+++ b/src/block_template.c
@@ -145,37 +145,37 @@ ALGnew(PyObject *self, PyObject *args, PyObject *kwdict)
return NULL;
}
- if (KEY_SIZE!=0 && keylen!=KEY_SIZE)
+ if (mode<MODE_ECB || mode>MODE_CTR)
{
PyErr_Format(PyExc_ValueError,
+ "Unknown cipher feedback mode %i",
+ mode);
+ return NULL;
+ }
+ if (mode == MODE_PGP) {
+ PyErr_Format(PyExc_ValueError,
+ "MODE_PGP is not supported anymore");
+ return NULL;
+ }
+ if (KEY_SIZE!=0 && keylen!=KEY_SIZE)
+ {
+ PyErr_Format(PyExc_ValueError,
"Key must be %i bytes long, not %i",
KEY_SIZE, keylen);
return NULL;
}
if (KEY_SIZE==0 && keylen==0)
{
- PyErr_SetString(PyExc_ValueError,
+ PyErr_SetString(PyExc_ValueError,
"Key cannot be the null string");
return NULL;
}
if (IVlen != BLOCK_SIZE && IVlen != 0)
{
- PyErr_Format(PyExc_ValueError,
+ PyErr_Format(PyExc_ValueError,
"IV must be %i bytes long", BLOCK_SIZE);
return NULL;
}
- if (mode<MODE_ECB || mode>MODE_CTR)
- {
- PyErr_Format(PyExc_ValueError,
- "Unknown cipher feedback mode %i",
- mode);
- return NULL;
- }
- if (mode == MODE_PGP) {
- PyErr_Format(PyExc_ValueError,
- "MODE_PGP is not supported anymore");
- return NULL;
- }
/* Mode-specific checks */
if (mode == MODE_CFB) {