X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/637b91402d2497db1318debd3cb3868a5abb8f01..6438edb82bafab97b8aad35ce7ce3d787dde9a99:/pubkey.c diff --git a/pubkey.c b/pubkey.c index a557ddb..2c906cd 100644 --- a/pubkey.c +++ b/pubkey.c @@ -108,11 +108,8 @@ end: return (rc); } -static PyObject *dsameth_beginhash(PyObject *me, PyObject *arg) -{ - if (!PyArg_ParseTuple(arg, ":beginhash")) return (0); - return (ghash_pywrap(DSA_HASH(me), gdsa_beginhash(DSA_D(me)))); -} +static PyObject *dsameth_beginhash(PyObject *me) + { return (ghash_pywrap(DSA_HASH(me), gdsa_beginhash(DSA_D(me)))); } static PyObject *dsameth_endhash(PyObject *me, PyObject *arg) { @@ -190,7 +187,7 @@ end: static const PyMethodDef dsapub_pymethods[] = { #define METHNAME(name) dsameth_##name - METH (beginhash, "D.beginhash() -> hash object") + NAMETH(beginhash, "D.beginhash() -> hash object") METH (endhash, "D.endhash(H) -> BYTES") METH (verify, "D.verify(MSG, (R, S)) -> true/false") #undef METHNAME @@ -363,11 +360,8 @@ end: return (rc); } -static PyObject *kcdsameth_beginhash(PyObject *me, PyObject *arg) -{ - if (!PyArg_ParseTuple(arg, ":beginhash")) return (0); - return (ghash_pywrap(DSA_HASH(me), gkcdsa_beginhash(DSA_D(me)))); -} +static PyObject *kcdsameth_beginhash(PyObject *me) + { return (ghash_pywrap(DSA_HASH(me), gkcdsa_beginhash(DSA_D(me)))); } static PyObject *kcdsameth_endhash(PyObject *me, PyObject *arg) { @@ -428,7 +422,7 @@ end: static const PyMethodDef kcdsapub_pymethods[] = { #define METHNAME(name) kcdsameth_##name - METH (beginhash, "D.beginhash() -> hash object") + NAMETH(beginhash, "D.beginhash() -> hash object") METH (endhash, "D.endhash(H) -> BYTES") METH (verify, "D.verify(MSG, (R, S)) -> true/false") #undef METHNAME @@ -726,8 +720,7 @@ end: return (rc); } -static PyObject *meth__RSAPriv_generate(PyObject *me, - PyObject *arg, PyObject *kw) +static PyObject *rsameth_generate(PyObject *me, PyObject *arg, PyObject *kw) { grand *r = &rand_global; unsigned nbits; @@ -737,12 +730,12 @@ static PyObject *meth__RSAPriv_generate(PyObject *me, struct excinfo exc = EXCINFO_INIT; pypgev evt = { { 0 } }; static const char *const kwlist[] = - { "class", "nbits", "event", "rng", "nsteps", "e", 0 }; + { "nbits", "event", "rng", "nsteps", "e", 0 }; PyObject *rc = 0; evt.exc = &exc; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST, - &me, convuint, &nbits, convpgev, &evt, + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O&O&O&O&:generate", KWLIST, + convuint, &nbits, convpgev, &evt, convgrand, &r, convuint, &n, convmp, &e)) goto end; @@ -787,7 +780,9 @@ static const PyGetSetDef rsapriv_pygetset[] = { static const PyMethodDef rsapriv_pymethods[] = { #define METHNAME(name) rsameth_##name - KWMETH(privop, "R.privop(X, [rng = None]) -> X^D (mod N)") + KWMETH(privop, "R.privop(X, [rng = None]) -> X^D (mod N)") + KWSMTH(generate, "generate(NBITS, [event = pgen_nullev], [rng = rand], " + "[nsteps = 0]) -> R") #undef METHNAME { 0 } }; @@ -1271,8 +1266,6 @@ static const PyMethodDef methods[] = { KWMETH(_oaep_decode, 0) KWMETH(_pss_encode, 0) KWMETH(_pss_decode, 0) - KWMETH(_RSAPriv_generate, "generate(NBITS, [event = pgen_nullev], " - "[rng = rand], [nsteps = 0]) -> R") #define DEFMETH(X, x) \ METH (x, "" #x "(KEY, PUBLIC) -> SHARED") XDHS(DEFMETH)