## C extension code.
include *.c *.h
+ include t/*.py t/keyring
include algorithms.py
exclude algorithms.h
+
+## Scripts.
+include pock
include pwsafe
+## Manual pages.
+include *.[13]
+
## Python wrapping.
recursive-include catacomb *.py
goto end; \
} while (0)
#define VALERR(str) EXCERR(PyExc_ValueError, str)
+ #define OVFERR(str) EXCERR(PyExc_OverflowError, str)
#define TYERR(str) EXCERR(PyExc_TypeError, str)
+#define IXERR(str) EXCERR(PyExc_IndexError, str)
#define ZDIVERR(str) EXCERR(PyExc_ZeroDivisionError, str)
#define SYSERR(str) EXCERR(PyExc_SystemError, str)
#define NIERR(str) EXCERR(PyExc_NotImplementedError, str)
return (d); \
}
- struct nameval { const char *name; unsigned long value; };
+#define KWLIST (/*unconst*/ char **)kwlist
+
+ struct nameval { const char *name; unsigned f; unsigned long value; };
+ #define CF_SIGNED 1u
extern void setconstants(PyObject *, const struct nameval *);
extern PyObject *mexp_common(PyObject *, PyObject *, size_t,
+catacomb-python (1.3.0.1) experimental; urgency=medium
+
+ * Fix required Catacomb version in `setup.py' script. Only affects the
+ source package.
+
+ -- Mark Wooding <mdw@distorted.org.uk> Sun, 22 Sep 2019 01:21:28 +0100
+
+catacomb-python (1.3.0) experimental; urgency=medium
+
+ * catacomb: Bindings for new blockcipher-based MACs, and AEAD schemes.
+ * catacomb: Invalidate `grand' objects passed into Python through prime-
+ generation events.
+ * catacomb: Improve class docstrings. (They're still extremely terse.)
+ * catacomb: Add missing `copy' methods on hash and Keccak objects.
+ * catacomb: Add `WriteBuffer.contents' as a more convenient way to
+ extract the contents than coercing to `str' or `ByteString'.
+ * catacomb: Set `RTLD_DEEPBIND' while loading the native module to work
+ around #868366.
+ * pock: New program for generating efficiently verifiable prime numbers,
+ and for verifying their certificates.
+
+ -- Mark Wooding <mdw@distorted.org.uk> Sat, 21 Sep 2019 23:00:25 +0100
+
+ catacomb-python (1.2.1.1) experimental; urgency=medium
+
+ * Fixing to build against Debian `stretch'.
+
+ -- Mark Wooding <mdw@distorted.org.uk> Mon, 24 Dec 2018 15:21:08 +0000
+
catacomb-python (1.2.1) experimental; urgency=low
* Fix use-after-free bug in ECPt hashing causing hash instability.
Priority: extra
XS-Python-Version: >= 2.6, << 2.8
Maintainer: Mark Wooding <mdw@distorted.org.uk>
- Build-Depends: debhelper (>= 9), pkg-config,
+ Build-Depends: debhelper (>= 9), dh-python, pkg-config,
python (>= 2.6.6-3~), python-all-dev,
- mlib-dev (>= 2.2.2.1), catacomb-dev (>= 2.4.0)
+ mlib-dev (>= 2.2.2.1), catacomb-dev (>= 2.5.0)
Standards-Version: 3.8.0
Package: python-catacomb
char *p;
ec_curve *c = ECPT_C(me);
ec pp = EC_INIT;
- int f = EC_EXPLY;
+ unsigned f = EC_EXPLY;
int len;
- char *kwlist[] = { "flags", 0 };
+ static const char *const kwlist[] = { "flags", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "|i:ectosp", KWLIST, &f))
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:ec2osp", kwlist,
++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:ec2osp", KWLIST,
+ convuint, &f))
return (0);
len = c->f->noctets * 2 + 1;
rc = bytestring_pywrap(0, len);
buf b;
PyObject *rc = 0;
ec_curve *cc;
- int f = EC_XONLY | EC_LSB | EC_SORT | EC_EXPLY;
+ unsigned f = EC_XONLY | EC_LSB | EC_SORT | EC_EXPLY;
ec pp = EC_INIT;
- static const char *const kwlist[] = { "buf", "flags", 0 };
- char *kwlist[] = { "class", "buf", "flags", 0 };
++ static const char *const kwlist[] = { "class", "buf", "flags", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|f:os2ecp", KWLIST,
- &me, &p, &len, &f))
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|O&:os2ecp", kwlist,
++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|O&:os2ecp", KWLIST,
+ &me, &p, &len, convuint, &f))
return (0);
buf_init(&b, p, len);
cc = ECCURVE_C(me);
unsigned ql = 0, pl;
unsigned steps = 0;
grand *r = &rand_global;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
- char *kwlist[] =
+ static const char *const kwlist[] =
{ "class", "pbits", "qbits", "event", "rng", "nsteps", 0 };
PyObject *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
&me, convuint, &pl, convuint, &ql,
convpgev, &evt, convgrand, &r,
convuint, &steps))
unsigned ql, pl;
unsigned steps = 0;
grand *r = &rand_global;
- pgev oe = { 0 }, ie = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev oe = { { 0 } }, ie = { { 0 } };
int subgroupp = 1;
unsigned f = 0;
- char *kwlist[] = { "class", "pbits", "qbits", "event", "ievent",
- "rng", "nsteps", "subgroupp", 0 };
+ static const char *const kwlist[] = {
+ "class", "pbits", "qbits", "event", "ievent",
+ "rng", "nsteps", "subgroupp", 0
+ };
size_t i, nf;
mp **v = 0;
PyObject *rc = 0, *vec = 0;
+ oe.exc = ie.exc = &exc;
if (!PyArg_ParseTupleAndKeywords(arg, kw,
- "OO&O&|O&O&O&O&O&:genlimlee", kwlist,
+ "OO&O&|O&O&O&O&O&:genlimlee", KWLIST,
&me, convuint, &pl, convuint, &ql,
convpgev, &oe, convpgev, &ie,
convgrand, &r, convuint, &steps,
unsigned ql, pl;
unsigned steps = 0;
grand *r = &rand_global;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
- char *kwlist[] = { "class", "pbits", "qbits",
- "event", "rng", "nsteps", 0 };
+ static const char *const kwlist[] =
+ { "class", "pbits", "qbits", "event", "rng", "nsteps", 0 };
mp *v = MP_NEW;
PyObject *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&|O&O&O&:genkcdsa", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&|O&O&O&:genkcdsa", KWLIST,
&me, convuint, &pl, convuint, &ql,
convpgev, &evt, convgrand, &r,
convuint, &steps))
dsa_seed ds;
char *k;
Py_ssize_t ksz;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
- char *kwlist[] =
+ static const char *const kwlist[] =
{ "class", "pbits", "qbits", "seed", "event", "nsteps", 0 };
PyObject *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&s#|O&O&:gendsa", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&O&s#|O&O&:gendsa", KWLIST,
&me, convuint, &pl, convuint, &ql,
&k, &ksz, convpgev, &evt,
convuint, &steps))
static PyObject *mpcrt_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
{
mpcrt_mod *v = 0;
- int n, i = 0;
+ Py_ssize_t n, i = 0, j;
- char *kwlist[] = { "mv", 0 };
+ static const char *const kwlist[] = { "mv", 0 };
PyObject *q = 0, *x;
- mp *xx;
+ mp *xx = MP_NEW, *y = MP_NEW, *g = MP_NEW;
+ mpmul mm;
mpcrt_pyobj *c = 0;
if (PyTuple_Size(arg) > 1)
PyObject *rc = 0;
int st = PGEN_ABORT;
long l;
- char *meth[] = {
- "pg_abort", "pg_done", "pg_begin", "pg_try", "pg_fail", "pg_pass"
- };
+ static const char *const meth[] =
+ { "pg_abort", "pg_done", "pg_begin", "pg_try", "pg_fail", "pg_pass" };
- Py_INCREF(py);
rq++;
if (rq > N(meth)) SYSERR("event code out of range");
pyev = pgevent_pywrap(ev);
- if ((rc = PyObject_CallMethod(py, (/*unconst*/ char *)meth[rq],
- if ((rc = PyObject_CallMethod(pg->obj, meth[rq], "(O)", pyev)) == 0)
++ if ((rc = PyObject_CallMethod(pg->obj, (/*unconst*/ char *)meth[rq],
+ "(O)", pyev)) == 0)
goto end;
if (rc == Py_None)
st = PGEN_TRY;
char *p = "p";
pgen_filterctx fc = { 2 };
rabin tc;
- pgev step = { 0 }, test = { 0 }, evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev step = { { 0 } }, test = { { 0 } }, evt = { { 0 } };
unsigned nsteps = 0, ntests = 0;
- char *kwlist[] = { "start", "name", "stepper", "tester", "event",
- "nsteps", "ntests", 0 };
+ static const char *const kwlist[] =
+ { "start", "name", "stepper", "tester", "event", "nsteps", "ntests", 0 };
- step.proc = pgen_filter; step.ctx = &fc;
- test.proc = pgen_test; test.ctx = &tc;
+ step.exc = &exc; step.ev.proc = pgen_filter; step.ev.ctx = &fc;
+ test.exc = &exc; test.ev.proc = pgen_test; test.ev.ctx = &tc;
+ evt.exc = &exc;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&O&O&:pgen", kwlist,
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&O&O&:pgen", KWLIST,
convmp, &x, &p, convpgev, &step,
convpgev, &test, convpgev, &evt,
convuint, &nsteps, convuint, &ntests))
unsigned nbits;
char *name = "p";
unsigned n = 0;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
PyObject *rc = 0;
- char *kwlist[] = { "nbits", "name", "event", "rng", "nsteps", 0 };
+ static const char *const kwlist[] =
+ { "nbits", "name", "event", "rng", "nsteps", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&", KWLIST,
convuint, &nbits, &name,
convpgev, &evt, convgrand, &r,
convuint, &n))
unsigned nbits;
char *name = "p";
unsigned n = 0;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
PyObject *rc = 0;
- char *kwlist[] = { "nbits", "name", "event", "rng", "nsteps", 0 };
+ static const char *const kwlist[] =
+ { "nbits", "name", "event", "rng", "nsteps", 0 };
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&|sO&O&O&", KWLIST,
convuint, &nbits, &name,
convpgev, &evt, convgrand, &r,
convuint, &n))
unsigned on = 0;
size_t i, nf = 0;
PyObject *rc = 0, *vec;
- char *kwlist[] = { "pbits", "qbits", "name", "event", "ievent",
- "rng", "nsteps", 0 };
+ static const char *const kwlist[] =
+ { "pbits", "qbits", "name", "event", "ievent", "rng", "nsteps", 0 };
mp *x = 0, **v = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|sO&O&O&O&:limlee", kwlist,
+ ie.exc = oe.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|sO&O&O&O&:limlee", KWLIST,
convuint, &pl, convuint, &ql,
&p, convpgev, &oe, convpgev, &ie,
convgrand, &r, convuint, &on))
unsigned n = 0;
rsa_priv rp;
mp *e = 0;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev 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;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
&me, convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n,
convmp, &e))
static PyObject *truerand_pynew(PyTypeObject *ty,
PyObject *arg, PyObject *kw)
{
- char *kwlist[] = { 0 };
+ static const char *const kwlist[] = { 0 };
grand *r;
PyObject *rc = 0;
- if (PyArg_ParseTupleAndKeywords(arg, kw, ":new", KWLIST)) goto end;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, ":new", kwlist)) goto end;
++ if (!PyArg_ParseTupleAndKeywords(arg, kw, ":new", KWLIST)) goto end;
r = rand_create();
r->ops->misc(r, RAND_NOISESRC, &noise_source);
r->ops->misc(r, RAND_SEED, 160);
static int bbsset_x(PyObject *me, PyObject *val, void *hunoz)
{
- mp *x = 0; grand *r = GRAND_R(me); int rc = -1; if (!x) NIERR("__del__");
+ mp *x = 0; grand *r = GRAND_R(me); int rc = -1; if (!val) NIERR("__del__");
- if ((x = getmp(val)) == 0) goto end; r->ops->misc(r, BBS_SET, x); rc = 0;
+ if ((x = getmp(val)) == 0) goto end;
+ r->ops->misc(r, BBS_SET, x); rc = 0;
end: mp_drop(x); return (rc);
}
{
bbs_priv bp = { 0 };
mp *x = MP_TWO;
- pgev evt = { 0 };
+ struct excinfo exc = EXCINFO_INIT;
+ pypgev evt = { { 0 } };
unsigned nbits, n = 0;
grand *r = &rand_global;
- char *kwlist[] = { "class", "nbits", "event", "rng", "nsteps", "seed", 0 };
+ static const char *const kwlist[] =
+ { "class", "nbits", "event", "rng", "nsteps", "seed", 0 };
bbspriv_pyobj *rc = 0;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", kwlist,
+ evt.exc = &exc;
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO&|O&O&O&O&:generate", KWLIST,
&me, convuint, &nbits, convpgev, &evt,
convgrand, &r, convuint, &n, convmp, &x))
goto end;
author_email = 'mdw@distorted.org.uk',
license = 'GNU General Public License',
packages = ['catacomb'],
- scripts = ['pwsafe'],
+ scripts = ['pock', 'pwsafe'],
+ data_files = [('share/man/man1', ['pock.1', 'pwsafe.1'])],
genfiles = [MS.Generate('algorithms.h')],
+ unittest_dir = "t",
+ unittests = ["t-misc", "t-algorithms", "t-bytes", "t-buffer",
+ "t-convert", "t-ec", "t-field", "t-group", "t-key",
+ "t-mp", "t-passphrase", "t-pgen", "t-pubkey",
+ "t-rand", "t-rat", "t-share"],
ext_modules = [cat])
{
PyObject *k, *def = Py_None, *v;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:get",
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:get", def_kwlist, &k, &def))
++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:get",
+ (/*unconst*/ char **)def_kwlist,
+ &k, &def))
return (0);
if ((v = PyObject_GetItem(me, k)) != 0) return (v);
PyErr_Clear();
{
PyObject *k, *def = Py_None, *v;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:setdefault",
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:setdefault",
- def_kwlist, &k, &def))
+ (/*unconst*/ char **)def_kwlist,
+ &k, &def))
return (0);
if ((v = PyObject_GetItem(me, k)) != 0) return (v);
PyErr_Clear();
{
PyObject *k, *def = 0, *v;
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "OO:pop",
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:pop", def_kwlist, &k, &def))
++ if (!PyArg_ParseTupleAndKeywords(arg, kw, "O|O:pop",
+ (/*unconst*/ char **)def_kwlist,
+ &k, &def))
return (0);
if ((v = PyObject_GetItem(me, k)) != 0) {
PyObject_DelItem(me, k);