chiark
/
gitweb
/
~mdw
/
catacomb-python
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bbd9455
)
algorithms.c: Check whether `setiv' and `bdry' are implemented before calling.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 7 May 2017 19:01:47 +0000
(20:01 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sun, 7 May 2017 19:01:47 +0000
(20:01 +0100)
Oops, easy segfault.
algorithms.c
patch
|
blob
|
blame
|
history
diff --git
a/algorithms.c
b/algorithms.c
index cb594ca31dd604f8297ea964b9457390f52ca89d..5b4f14b0e7d982922a8f0145efd1246c0269ada6 100644
(file)
--- a/
algorithms.c
+++ b/
algorithms.c
@@
-566,6
+566,7
@@
static PyObject *gcmeth_setiv(PyObject *me, PyObject *arg)
Py_ssize_t sz;
if (!PyArg_ParseTuple(arg, "s#:setiv", &p, &sz)) goto end;
Py_ssize_t sz;
if (!PyArg_ParseTuple(arg, "s#:setiv", &p, &sz)) goto end;
+ if (!GCIPHER_C(me)->ops->setiv) VALERR("`setiv' not supported");
if (!GC_CLASS(GCIPHER_C(me))->blksz) VALERR("not a block cipher mode");
if (sz != GC_CLASS(GCIPHER_C(me))->blksz) VALERR("bad IV length");
GC_SETIV(GCIPHER_C(me), p);
if (!GC_CLASS(GCIPHER_C(me))->blksz) VALERR("not a block cipher mode");
if (sz != GC_CLASS(GCIPHER_C(me))->blksz) VALERR("bad IV length");
GC_SETIV(GCIPHER_C(me), p);
@@
-577,6
+578,7
@@
end:
static PyObject *gcmeth_bdry(PyObject *me, PyObject *arg)
{
if (!PyArg_ParseTuple(arg, ":bdry")) goto end;
static PyObject *gcmeth_bdry(PyObject *me, PyObject *arg)
{
if (!PyArg_ParseTuple(arg, ":bdry")) goto end;
+ if (!GCIPHER_C(me)->ops->bdry) VALERR("`bdry' not supported");
if (!GC_CLASS(GCIPHER_C(me))->blksz) VALERR("not a block cipher mode");
GC_BDRY(GCIPHER_C(me));
RETURN_ME;
if (!GC_CLASS(GCIPHER_C(me))->blksz) VALERR("not a block cipher mode");
GC_BDRY(GCIPHER_C(me));
RETURN_ME;