chiark
/
gitweb
/
~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
algorithms.c, knock-on: Eliminate `f_freeme' flags.
[catacomb-python]
/
pubkey.c
diff --git
a/pubkey.c
b/pubkey.c
index 56b7d9ca41c5df37188f1bb20746bd2de0aed742..9c43ca723db0fd3e66bac162ec1c19822bbda098 100644
(file)
--- a/
pubkey.c
+++ b/
pubkey.c
@@
-96,9
+96,9
@@
static PyObject *dsapub_pynew(PyTypeObject *ty,
{
PyObject *G, *p, *rng = rand_pyobj, *hash = sha_pyobj;
PyObject *rc = 0;
{
PyObject *G, *p, *rng = rand_pyobj, *hash = sha_pyobj;
PyObject *rc = 0;
-
char *
kwlist[] = { "G", "p", "hash", "rng", 0 };
+
static const char *const
kwlist[] = { "G", "p", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!O!:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!O!:new",
KWLIST
,
group_pytype, &G,
ge_pytype, &p,
gchash_pytype, &hash,
group_pytype, &G,
ge_pytype, &p,
gchash_pytype, &hash,
@@
-112,7
+112,7
@@
end:
static PyObject *dsameth_beginhash(PyObject *me, PyObject *arg)
{
if (!PyArg_ParseTuple(arg, ":beginhash")) return (0);
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))
, f_freeme
));
+ return (ghash_pywrap(DSA_HASH(me), gdsa_beginhash(DSA_D(me))));
}
static PyObject *dsameth_endhash(PyObject *me, PyObject *arg)
}
static PyObject *dsameth_endhash(PyObject *me, PyObject *arg)
@@
-135,9
+135,9
@@
static PyObject *dsameth_sign(PyObject *me, PyObject *arg, PyObject *kw)
Py_ssize_t n;
mp *k = 0;
PyObject *rc = 0;
Py_ssize_t n;
mp *k = 0;
PyObject *rc = 0;
-
char *
kwlist[] = { "msg", "k", 0 };
+
static const char *const
kwlist[] = { "msg", "k", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|O&:sign",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|O&:sign",
KWLIST
,
&p, &n, convmp, &k))
goto end;
if (n != DSA_D(me)->h->hashsz)
&p, &n, convmp, &k))
goto end;
if (n != DSA_D(me)->h->hashsz)
@@
-175,9
+175,9
@@
static PyObject *dsapriv_pynew(PyTypeObject *ty,
{
PyObject *G, *p = 0, *u, *rng = rand_pyobj, *hash = sha_pyobj;
PyObject *rc = 0;
{
PyObject *G, *p = 0, *u, *rng = rand_pyobj, *hash = sha_pyobj;
PyObject *rc = 0;
-
char *
kwlist[] = { "G", "u", "p", "hash", "rng", 0 };
+
static const char *const
kwlist[] = { "G", "u", "p", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O|O!O!O!:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O|O!O!O!:new",
KWLIST
,
group_pytype, &G,
&u,
ge_pytype, &p,
group_pytype, &G,
&u,
ge_pytype, &p,
@@
-323,9
+323,9
@@
static PyObject *kcdsapub_pynew(PyTypeObject *ty,
{
PyObject *G, *p, *rng = rand_pyobj, *hash = has160_pyobj;
PyObject *rc = 0;
{
PyObject *G, *p, *rng = rand_pyobj, *hash = has160_pyobj;
PyObject *rc = 0;
-
char *
kwlist[] = { "G", "p", "hash", "rng", 0 };
+
static const char *const
kwlist[] = { "G", "p", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!O!:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O!|O!O!:new",
KWLIST
,
group_pytype, &G,
ge_pytype, &p,
gchash_pytype, &hash,
group_pytype, &G,
ge_pytype, &p,
gchash_pytype, &hash,
@@
-348,9
+348,9
@@
static PyObject *kcdsapriv_pynew(PyTypeObject *ty,
{
PyObject *G, *u, *p = 0, *rng = rand_pyobj, *hash = has160_pyobj;
PyObject *rc = 0;
{
PyObject *G, *u, *p = 0, *rng = rand_pyobj, *hash = has160_pyobj;
PyObject *rc = 0;
-
char *
kwlist[] = { "G", "u", "p", "hash", "rng", 0 };
+
static const char *const
kwlist[] = { "G", "u", "p", "hash", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O|O!O!O!:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O!O|O!O!O!:new",
KWLIST
,
group_pytype, &G,
&u,
ge_pytype, &p,
group_pytype, &G,
&u,
ge_pytype, &p,
@@
-366,7
+366,7
@@
end:
static PyObject *kcdsameth_beginhash(PyObject *me, PyObject *arg)
{
if (!PyArg_ParseTuple(arg, ":beginhash")) return (0);
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))
, f_freeme
));
+ return (ghash_pywrap(DSA_HASH(me), gkcdsa_beginhash(DSA_D(me))));
}
static PyObject *kcdsameth_endhash(PyObject *me, PyObject *arg)
}
static PyObject *kcdsameth_endhash(PyObject *me, PyObject *arg)
@@
-389,9
+389,9
@@
static PyObject *kcdsameth_sign(PyObject *me, PyObject *arg, PyObject *kw)
Py_ssize_t n;
mp *k = 0;
PyObject *r = 0, *rc = 0;
Py_ssize_t n;
mp *k = 0;
PyObject *r = 0, *rc = 0;
-
char *
kwlist[] = { "msg", "k", 0 };
+
static const char *const
kwlist[] = { "msg", "k", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|O&:sign",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#|O&:sign",
KWLIST
,
&p, &n, convmp, &k))
goto end;
if (n != DSA_D(me)->h->hashsz)
&p, &n, convmp, &k))
goto end;
if (n != DSA_D(me)->h->hashsz)
@@
-569,9
+569,9
@@
static PyObject *rsapub_pynew(PyTypeObject *ty,
{
rsa_pub rp = { 0 };
rsapub_pyobj *o;
{
rsa_pub rp = { 0 };
rsapub_pyobj *o;
-
char *
kwlist[] = { "n", "e", 0 };
+
static const char *const
kwlist[] = { "n", "e", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new",
KWLIST
,
convmp, &rp.n, convmp, &rp.e))
goto end;
if (!MP_ODDP(rp.n)) VALERR("RSA modulus must be even");
convmp, &rp.n, convmp, &rp.e))
goto end;
if (!MP_ODDP(rp.n)) VALERR("RSA modulus must be even");
@@
-636,10
+636,10
@@
static PyObject *rsapriv_pynew(PyTypeObject *ty,
{
rsa_priv rp = { 0 };
PyObject *rng = Py_None;
{
rsa_priv rp = { 0 };
PyObject *rng = Py_None;
-
char *
kwlist[] =
+
static const char *const
kwlist[] =
{ "n", "e", "d", "p", "q", "dp", "dq", "q_inv", "rng", 0 };
{ "n", "e", "d", "p", "q", "dp", "dq", "q_inv", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&O&O&O&O&O&O&O&O:new",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&O&O&O&O&O&O&O&O:new",
KWLIST
,
convmp, &rp.n, convmp, &rp.e,
convmp, &rp.d,
convmp, &rp.p, convmp, &rp.q,
convmp, &rp.n, convmp, &rp.e,
convmp, &rp.d,
convmp, &rp.p, convmp, &rp.q,
@@
-711,9
+711,9
@@
static PyObject *rsameth_privop(PyObject *me, PyObject *arg, PyObject *kw)
PyObject *rng = RSA_RNG(me);
mp *x = 0;
PyObject *rc = 0;
PyObject *rng = RSA_RNG(me);
mp *x = 0;
PyObject *rc = 0;
-
char *
kwlist[] = { "x", "rng", 0 };
+
static const char *const
kwlist[] = { "x", "rng", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O:privop",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|O:privop",
KWLIST
,
convmp, &x, &rng))
goto end;
if (rng != Py_None && !GRAND_PYCHECK(rng))
convmp, &x, &rng))
goto end;
if (rng != Py_None && !GRAND_PYCHECK(rng))
@@
-734,10
+734,11
@@
static PyObject *meth__RSAPriv_generate(PyObject *me,
rsa_priv rp;
mp *e = 0;
pgev evt = { 0 };
rsa_priv rp;
mp *e = 0;
pgev evt = { 0 };
- char *kwlist[] = { "class", "nbits", "event", "rng", "nsteps", "e", 0 };
+ static const char *const kwlist[] =
+ { "class", "nbits", "event", "rng", "nsteps", "e", 0 };
PyObject *rc = 0;
PyObject *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate",
KWLIST
,
&me, convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n,
convmp, &e))
&me, convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n,
convmp, &e))
@@
-898,10
+899,10
@@
static PyObject *meth__p1crypt_encode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x;
octet *b = 0;
size_t sz;
mp *x;
-
char *
kwlist[] = { "msg", "nbits", "ep", "rng", 0 };
+
static const char *const
kwlist[] = { "msg", "nbits", "ep", "rng", 0 };
p1.r = &rand_global; ep = 0; epsz = 0;
p1.r = &rand_global; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|s#O&:encode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|s#O&:encode",
KWLIST
,
&m, &msz, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
&m, &msz, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
@@
-928,10
+929,10
@@
static PyObject *meth__p1crypt_decode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x = 0;
octet *b = 0;
size_t sz;
mp *x = 0;
-
char *
kwlist[] = { "ct", "nbits", "ep", "rng", 0 };
+
static const char *const
kwlist[] = { "ct", "nbits", "ep", "rng", 0 };
p1.r = &rand_global; ep = 0; epsz = 0;
p1.r = &rand_global; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|s#O&:decode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|s#O&:decode",
KWLIST
,
convmp, &x, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
convmp, &x, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
@@
-959,10
+960,10
@@
static PyObject *meth__p1sig_encode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x;
octet *b = 0;
size_t sz;
mp *x;
-
char *
kwlist[] = { "msg", "nbits", "ep", "rng", 0 };
+
static const char *const
kwlist[] = { "msg", "nbits", "ep", "rng", 0 };
p1.r = &rand_global; ep = 0; epsz = 0;
p1.r = &rand_global; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|s#O&:encode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|s#O&:encode",
KWLIST
,
&m, &msz, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
&m, &msz, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
@@
-990,10
+991,11
@@
static PyObject *meth__p1sig_decode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x = 0;
octet *b = 0;
size_t sz;
mp *x = 0;
- char *kwlist[] = { "msg", "sig", "nbits", "ep", "rng", 0 };
+ static const char *const kwlist[] =
+ { "msg", "sig", "nbits", "ep", "rng", 0 };
p1.r = &rand_global; ep = 0; epsz = 0;
p1.r = &rand_global; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&|s#O&:decode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&|s#O&:decode",
KWLIST
,
&hukairz, convmp, &x, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
&hukairz, convmp, &x, convulong, &nbits,
&ep, &epsz, convgrand, &p1.r))
goto end;
@@
-1021,10
+1023,11
@@
static PyObject *meth__oaep_encode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x;
octet *b = 0;
size_t sz;
mp *x;
- char *kwlist[] = { "msg", "nbits", "mgf", "hash", "ep", "rng", 0 };
+ static const char *const kwlist[] =
+ { "msg", "nbits", "mgf", "hash", "ep", "rng", 0 };
o.r = &rand_global; o.cc = &sha_mgf; o.ch = &sha; ep = 0; epsz = 0;
o.r = &rand_global; o.cc = &sha_mgf; o.ch = &sha; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|O&O&s#O&:encode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|O&O&s#O&:encode",
KWLIST
,
&m, &msz, convulong, &nbits,
convgccipher, &o.cc,
convgchash, &o.ch,
&m, &msz, convulong, &nbits,
convgccipher, &o.cc,
convgchash, &o.ch,
@@
-1054,10
+1057,11
@@
static PyObject *meth__oaep_decode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x = 0;
octet *b = 0;
size_t sz;
mp *x = 0;
- char *kwlist[] = { "ct", "nbits", "mgf", "hash", "ep", "rng", 0 };
+ static const char *const kwlist[] =
+ { "ct", "nbits", "mgf", "hash", "ep", "rng", 0 };
o.r = &rand_global; o.cc = &sha_mgf; o.ch = &sha; ep = 0; epsz = 0;
o.r = &rand_global; o.cc = &sha_mgf; o.ch = &sha; ep = 0; epsz = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&s#O&:decode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&s#O&:decode",
KWLIST
,
convmp, &x, convulong, &nbits,
convgccipher, &o.cc,
convgchash, &o.ch,
convmp, &x, convulong, &nbits,
convgccipher, &o.cc,
convgchash, &o.ch,
@@
-1088,10
+1092,11
@@
static PyObject *meth__pss_encode(PyObject *me,
octet *b = 0;
size_t sz;
mp *x = 0;
octet *b = 0;
size_t sz;
mp *x = 0;
- char *kwlist[] = { "msg", "nbits", "mgf", "hash", "saltsz", "rng", 0 };
+ static const char *const kwlist[] =
+ { "msg", "nbits", "mgf", "hash", "saltsz", "rng", 0 };
p.cc = &sha_mgf; p.ch = &sha; p.r = &rand_global; p.ssz = (size_t)-1;
p.cc = &sha_mgf; p.ch = &sha; p.r = &rand_global; p.ssz = (size_t)-1;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|O&O&O&O&:encode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&|O&O&O&O&:encode",
KWLIST
,
&m, &msz, convulong, &nbits,
convgccipher, &p.cc,
convgchash, &p.ch,
&m, &msz, convulong, &nbits,
convgccipher, &p.cc,
convgchash, &p.ch,
@@
-1121,11
+1126,11
@@
static PyObject *meth__pss_decode(PyObject *me,
size_t sz;
int n;
mp *x = 0;
size_t sz;
int n;
mp *x = 0;
-
char *
kwlist[] =
+
static const char *const
kwlist[] =
{ "msg", "sig", "nbits", "mgf", "hash", "saltsz", "rng", 0 };
p.cc = &sha_mgf; p.ch = &sha; p.r = &rand_global; p.ssz = (size_t)-1;
{ "msg", "sig", "nbits", "mgf", "hash", "saltsz", "rng", 0 };
p.cc = &sha_mgf; p.ch = &sha; p.r = &rand_global; p.ssz = (size_t)-1;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&O&|O&O&O&O&:decode",
kwlist
,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "s#O&O&|O&O&O&O&:decode",
KWLIST
,
&m, &msz, convmp, &x, convulong, &nbits,
convgccipher, &p.cc,
convgchash, &p.ch,
&m, &msz, convmp, &x, convulong, &nbits,
convgccipher, &p.cc,
convgchash, &p.ch,
@@
-1201,10
+1206,11
@@
XDHS(DEFXDH)
int ph = phdflt; \
PyObject *rc = 0; \
octet pp[ED##_PUBSZ]; \
int ph = phdflt; \
PyObject *rc = 0; \
octet pp[ED##_PUBSZ]; \
- char *kwlist[] = { "key", "msg", "pub", "perso", "phflag", 0 }; \
+ static const char *const kwlist[] = \
+ { "key", "msg", "pub", "perso", "phflag", 0 }; \
if (!PyArg_ParseTupleAndKeywords(arg, kw, \
"s#s#|s#s#O&:" #ed "_sign", \
if (!PyArg_ParseTupleAndKeywords(arg, kw, \
"s#s#|s#s#O&:" #ed "_sign", \
-
kwlist
, \
+
KWLIST
, \
&k, &ksz, &m, &msz, &p, &psz, \
&c, &csz, convbool, &ph)) \
goto end; \
&k, &ksz, &m, &msz, &p, &psz, \
&c, &csz, convbool, &ph)) \
goto end; \
@@
-1228,10
+1234,11
@@
XDHS(DEFXDH)
Py_ssize_t psz, csz = 0, msz, ssz; \
int ph = phdflt; \
PyObject *rc = 0; \
Py_ssize_t psz, csz = 0, msz, ssz; \
int ph = phdflt; \
PyObject *rc = 0; \
- char *kwlist[] = { "pub", "msg", "sig", "perso", "phflag", 0 }; \
+ static const char *const kwlist[] = \
+ { "pub", "msg", "sig", "perso", "phflag", 0 }; \
if (!PyArg_ParseTupleAndKeywords(arg, kw, \
"s#s#s#|s#O&:" #ed "_verify", \
if (!PyArg_ParseTupleAndKeywords(arg, kw, \
"s#s#s#|s#O&:" #ed "_verify", \
-
kwlist
, \
+
KWLIST
, \
&p, &psz, &m, &msz, &s, &ssz, \
&c, &csz, convbool, &ph)) \
goto end; \
&p, &psz, &m, &msz, &s, &ssz, \
&c, &csz, convbool, &ph)) \
goto end; \