X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/blobdiff_plain/06cd26e87f5b839d40f0e7b57e38aea6c231b385..361fd0e6cf51addf72f8b34e6909ff6ac16309f6:/share.c?ds=sidebyside diff --git a/share.c b/share.c index 3d4817e..342144e 100644 --- a/share.c +++ b/share.c @@ -86,7 +86,7 @@ static PyTypeObject gfshare_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"Binary-field secret sharing base class.", + "Binary-field secret sharing base class.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -117,8 +117,8 @@ static PyObject *gfsharesplit_pynew(PyTypeObject *ty, unsigned t; grand *r = &rand_global; gfshare_pyobj *s; - char *kwlist[] = { "threshold", "secret", "rng", 0 }; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&s#|O&:new", kwlist, + static const char *const kwlist[] = { "threshold", "secret", "rng", 0 }; + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&s#|O&:new", KWLIST, convuint, &t, &p, &n, convgrand, &r)) goto end; if (!t || t > 255) VALERR("threshold must be nonzero and < 256"); @@ -174,8 +174,8 @@ static PyTypeObject gfsharesplit_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"GFShareSplit(THRESHOLD, SECRET, [rng = rand]): binary-field sharing:\n\ - split secret into shares.", + "GFShareSplit(THRESHOLD, SECRET, [rng = rand]): binary-field sharing:\n" + " split secret into shares.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -203,8 +203,8 @@ static PyObject *gfsharejoin_pynew(PyTypeObject *ty, { unsigned t, sz; gfshare_pyobj *s; - char *kwlist[] = { "threshold", "size", 0 }; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", kwlist, + static const char *const kwlist[] = { "threshold", "size", 0 }; + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", KWLIST, convuint, &t, convuint, &sz)) goto end; if (!t || t > 255) VALERR("threshold must be nonzero and < 256"); @@ -296,8 +296,8 @@ static PyTypeObject gfsharejoin_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"GFShareJoin(THRESHOLD, SIZE): binary field sharing:\n\ - join shares to recover secret.", + "GFShareJoin(THRESHOLD, SIZE): binary field sharing:\n" + " join shares to recover secret.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -378,7 +378,7 @@ static PyTypeObject share_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"Prime-field secret sharing base class.", + "Prime-field secret sharing base class.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -409,8 +409,10 @@ static PyObject *sharesplit_pynew(PyTypeObject *ty, grand *r = &rand_global; mp *m = 0; share_pyobj *s; - char *kwlist[] = { "threshold", "secret", "modulus", "rng", 0 }; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&:new", kwlist, + static const char *const kwlist[] = + { "threshold", "secret", "modulus", "rng", 0 }; + + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&:new", KWLIST, convuint, &t, convmp, &sec, convmp, &m, convgrand, &r)) goto end; @@ -469,8 +471,8 @@ static PyTypeObject sharesplit_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ShareSplit(THRESHOLD, SECRET, [modulus = ?], [rng = rand]):\n\ - prime field secret sharing: split secret into shares.", + "ShareSplit(THRESHOLD, SECRET, [modulus = ?], [rng = rand]):\n" + " prime field secret sharing: split secret into shares.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */ @@ -499,8 +501,8 @@ static PyObject *sharejoin_pynew(PyTypeObject *ty, unsigned t; mp *m = 0; share_pyobj *s; - char *kwlist[] = { "threshold", "modulus", 0 }; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", kwlist, + static const char *const kwlist[] = { "threshold", "modulus", 0 }; + if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&:new", KWLIST, convuint, &t, convmp, &m)) goto end; if (!t) VALERR("threshold must be nonzero"); @@ -593,8 +595,8 @@ static PyTypeObject sharejoin_pytype_skel = { Py_TPFLAGS_BASETYPE, /* @tp_doc@ */ -"ShareJoin(THRESHOLD, MODULUS): prime field secret sharing:\n\ - join shares to recover secret.", + "ShareJoin(THRESHOLD, MODULUS): prime field secret sharing:\n" + " join shares to recover secret.", 0, /* @tp_traverse@ */ 0, /* @tp_clear@ */