return (0);
}
-static PyObject *gcmeth_bdry(PyObject *me, PyObject *arg)
+static PyObject *gcmeth_bdry(PyObject *me)
{
- 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));
METH (decrypt, "C.decrypt(CT) -> PT")
METH (deczero, "C.deczero(N) -> PT")
METH (setiv, "C.setiv(IV)")
- METH (bdry, "C.bdry()")
+ NAMETH(bdry, "C.bdry()")
#undef METHNAME
{ 0 }
};
{ 0 }
};
-static PyObject *gaekmeth_aad(PyObject *me, PyObject *arg)
+static PyObject *gaekmeth_aad(PyObject *me)
{
const gaead_key *k = GAEADKEY_K(me);
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, ":aad")) return (0);
if (k->ops->c->f&AEADF_AADNDEP)
VALERR("aad must be associated with enc/dec op");
rc = gaeadaad_pywrap((PyObject *)GCAEAD_AAD(me->ob_type),
static const PyMethodDef gaeadkey_pymethods[] = {
#define METHNAME(name) gaekmeth_##name
- METH (aad, "KEY.aad() -> AAD")
+ NAMETH(aad, "KEY.aad() -> AAD")
KWMETH(enc, "KEY.enc(NONCE, [hsz], [msz], [tsz]) -> ENC")
KWMETH(dec, "KEY.dec(NONCE, [hsz], [csz], [tsz]) -> DEC")
#undef METHNAME
{ 0 }
};
-static PyObject *gaeameth_copy(PyObject *me, PyObject *arg)
+static PyObject *gaeameth_copy(PyObject *me)
{
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, ":copy")) goto end;
if (gaea_check(me)) goto end;
if (GAEADAAD_F(me)&AEADF_AADNDEP)
VALERR("can't duplicate nonce-dependent aad");
static const PyMethodDef gaeadaad_pymethods[] = {
#define METHNAME(name) gaeameth_##name
- METH (copy, "AAD.copy() -> AAD'")
+ NAMETH(copy, "AAD.copy() -> AAD'")
METH (hash, "AAD.hash(H)")
#define METHU_(n, W, w) METH(hashu##w, "AAD.hashu" #w "(WORD)")
DOUINTCONV(METHU_)
{ 0 }
};
-static PyObject *gaeemeth_aad(PyObject *me, PyObject *arg)
+static PyObject *gaeemeth_aad(PyObject *me)
{
gaeadenc_pyobj *ge = (gaeadenc_pyobj *)me;
PyObject *rc = 0;
- if (!PyArg_ParseTuple(arg, ":aad")) return (0);
if (!(ge->f&AEADF_AADNDEP))
rc = gaeadaad_pywrap((PyObject *)GCAEADENC_KEY(ge->ob_type)->aad,
GAEAD_AAD(ge->e), 0, 0);
static const PyMethodDef gaeadenc_pymethods[] = {
#define METHNAME(name) gaeemeth_##name
- METH (aad, "ENC.aad() -> AAD")
+ NAMETH(aad, "ENC.aad() -> AAD")
KWMETH(reinit, "ENC.reinit(NONCE, [hsz], [msz], [tsz])")
METH (encrypt, "ENC.encrypt(MSG) -> CT")
KWMETH(done, "ENC.done([tsz], [aad]) -> CT, TAG")
{ 0 }
};
-static PyObject *gaedmeth_aad(PyObject *me, PyObject *arg)
+static PyObject *gaedmeth_aad(PyObject *me)
{
gaeaddec_pyobj *gd = (gaeaddec_pyobj *)me;
- if (!PyArg_ParseTuple(arg, ":aad")) return (0);
if (!(gd->f&AEADF_AADNDEP))
return (gaeadaad_pywrap((PyObject *)GCAEADDEC_KEY(gd->ob_type)->aad,
GAEAD_AAD(gd->d), 0, 0));
static const PyMethodDef gaeaddec_pymethods[] = {
#define METHNAME(name) gaedmeth_##name
- METH (aad, "DEC.aad() -> AAD")
+ NAMETH(aad, "DEC.aad() -> AAD")
KWMETH(reinit, "DEC.reinit(NONCE, [hsz], [csz], [tsz])")
METH (decrypt, "DEC.decrypt(CT) -> MSG")
KWMETH(done, "DEC.done(TAG, [aad]) -> MSG | None")
static PyObject *gchget_bufsz(PyObject *me, void *hunoz)
{ return (PyInt_FromLong(GCHASH_CH(me)->bufsz)); }
-static PyObject *ghmeth_copy(PyObject *me, PyObject *arg)
-{
- if (!PyArg_ParseTuple(arg, ":copy")) return (0);
- return (ghash_pywrap((PyObject *)me->ob_type, GH_COPY(GHASH_H(me))));
-}
+static PyObject *ghmeth_copy(PyObject *me)
+ { return (ghash_pywrap((PyObject *)me->ob_type, GH_COPY(GHASH_H(me)))); }
static PyObject *ghmeth_hash(PyObject *me, PyObject *arg)
{
RETURN_ME;
}
-static PyObject *ghmeth_done(PyObject *me, PyObject *arg)
+static PyObject *ghmeth_done(PyObject *me)
{
ghash *g;
PyObject *rc;
- if (!PyArg_ParseTuple(arg, ":done")) return (0);
g = GH_COPY(GHASH_H(me));
rc = bytestring_pywrap(0, g->ops->c->hashsz);
GH_DONE(g, PyString_AS_STRING(rc));
static const PyMethodDef ghash_pymethods[] = {
#define METHNAME(name) ghmeth_##name
- METH (copy, "H.copy() -> HH")
+ NAMETH(copy, "H.copy() -> HH")
METH (hash, "H.hash(M)")
#define METHU_(n, W, w) METH(hashu##w, "H.hashu" #w "(WORD)")
DOUINTCONV(METHU_)
DOUINTCONV(METHBUF_)
#undef METHBUF_
METH (hashstrz, "H.hashstrz(STRING)")
- METH (done, "H.done() -> HASH")
+ NAMETH(done, "H.done() -> HASH")
#undef METHNAME
{ 0 }
};
static PyObject *poly1305clsget_tagsz(PyObject *me, void *hunoz)
{ return (PyInt_FromLong(POLY1305_TAGSZ)); }
-static PyObject *polymeth_copy(PyObject *me, PyObject *arg)
+static PyObject *polymeth_copy(PyObject *me)
{
poly1305hash_pyobj *ph;
- if (!PyArg_ParseTuple(arg, ":copy")) return (0);
ph = PyObject_NEW(poly1305hash_pyobj, me->ob_type);
poly1305_copy(&ph->ctx, P1305_CTX(me));
Py_INCREF(me->ob_type);
RETURN_ME;
}
-static PyObject *polymeth_flush(PyObject *me, PyObject *arg)
-{
- if (!PyArg_ParseTuple(arg, ":flush")) return (0);
- poly1305_flush(P1305_CTX(me));
- RETURN_ME;
-}
+static PyObject *polymeth_flush(PyObject *me)
+ { poly1305_flush(P1305_CTX(me)); RETURN_ME; }
-static PyObject *polymeth_flushzero(PyObject *me, PyObject *arg)
-{
- if (!PyArg_ParseTuple(arg, ":flushzero")) return (0);
- poly1305_flushzero(P1305_CTX(me));
- RETURN_ME;
-}
+static PyObject *polymeth_flushzero(PyObject *me)
+ { poly1305_flushzero(P1305_CTX(me)); RETURN_ME; }
static PyObject *polymeth_concat(PyObject *me, PyObject *arg)
{
return (0);
}
-static PyObject *polymeth_done(PyObject *me, PyObject *arg)
+static PyObject *polymeth_done(PyObject *me)
{
PyObject *rc;
- if (!PyArg_ParseTuple(arg, ":done")) return (0);
if (!(P1305_F(me) & f_mask)) VALERR("no mask");
rc = bytestring_pywrap(0, POLY1305_TAGSZ);
poly1305_done(P1305_CTX(me), PyString_AS_STRING(rc));
static const PyMethodDef poly1305hash_pymethods[] = {
#define METHNAME(name) polymeth_##name
- METH (copy, "P.copy() -> PP")
+ NAMETH(copy, "P.copy() -> PP")
METH (hash, "P.hash(M)")
#define METHU_(n, W, w) METH(hashu##w, "P.hashu" #w "(WORD)")
DOUINTCONV(METHU_)
DOUINTCONV(METHBUF_)
#undef METHBUF_
METH (hashstrz, "P.hashstrz(STRING)")
- METH (flush, "P.flush()")
- METH (flushzero, "P.flushzero()")
+ NAMETH(flush, "P.flush()")
+ NAMETH(flushzero, "P.flushzero()")
METH (concat, "P.concat(PREFIX, SUFFIX)")
- METH (done, "P.done() -> TAG")
+ NAMETH(done, "P.done() -> TAG")
#undef METHNAME
{ 0 }
};
return ((PyObject *)rc);
}
-static PyObject *kxvikmeth_copy(PyObject *me, PyObject *arg)
+static PyObject *kxvikmeth_copy(PyObject *me)
{
kxvik_pyobj *k = (kxvik_pyobj *)me, *rc = 0;
- if (!PyArg_ParseTuple(arg, ":copy")) goto end;
rc = (kxvik_pyobj *)k->ob_type->tp_alloc(k->ob_type, 0);
rc->s = k->s; rc->n = k->n;
-end:
return ((PyObject *)rc);
}
return (rc);
}
-static PyObject *kxvikmeth_step(PyObject *me, PyObject *arg)
+static PyObject *kxvikmeth_step(PyObject *me)
{
kxvik_pyobj *k = (kxvik_pyobj *)me;
- if (!PyArg_ParseTuple(arg, ":step")) return (0);
keccak1600_p(&k->s, &k->s, k->n);
RETURN_ME;
}
static const PyMethodDef kxvik_pymethods[] = {
#define METHNAME(func) kxvikmeth_##func
- METH (copy, "KECCAK.copy() -> KECCAK'")
+ NAMETH(copy, "KECCAK.copy() -> KECCAK'")
METH (mix, "KECCAK.mix(DATA)")
METH (extract, "KECCAK.extract(NOCTETS)")
- METH (step, "KECCAK.step()")
+ NAMETH(step, "KECCAK.step()")
#undef METHNAME
{ 0 }
};
RETURN_ME;
}
-static PyObject *shakemeth_xof(PyObject *me, PyObject *arg)
+static PyObject *shakemeth_xof(PyObject *me)
{
- if (!PyArg_ParseTuple(arg, ":xof")) goto end;
if (shake_check(me, 0)) goto end;
shake_xof(SHAKE_H(me));
SHAKE_ST(me) = 1;
return (rc);
}
-static PyObject *shakemeth_copy(PyObject *me, PyObject *arg)
+static PyObject *shakemeth_copy(PyObject *me)
{
shake_pyobj *rc = 0;
- if (!PyArg_ParseTuple(arg, ":copy")) goto end;
rc = PyObject_NEW(shake_pyobj, me->ob_type);
rc->h = *SHAKE_H(me);
rc->st = SHAKE_ST(me);
-end:
return ((PyObject *)rc);
}
static const PyMethodDef shake_pymethods[] = {
#define METHNAME(func) shakemeth_##func
- METH (copy, "S.copy() -> SS")
+ NAMETH(copy, "S.copy() -> SS")
METH (hash, "S.hash(M)")
#define METHU_(n, W, w) METH(hashu##w, "S.hashu" #w "(WORD)")
DOUINTCONV(METHU_)
DOUINTCONV(METHBUF_)
#undef METHBUF_
METH (hashstrz, "S.hashstrz(STRING)")
- METH (xof, "S.xof()")
+ NAMETH(xof, "S.xof()")
METH (done, "S.done(LEN) -> H")
METH (get, "S.get(LEN) -> H")
METH (mask, "S.mask(M) -> C")