chiark / gitweb /
debian/: Use `dh_python2' for packaging.
[catacomb-python] / share.c
diff --git a/share.c b/share.c
index 38d966e8dbc15083fcf4bce20077f9d35257d909..3d4817e5dac98b7cb8be79e2beb4c2c86d68ae70 100644 (file)
--- a/share.c
+++ b/share.c
@@ -1,13 +1,11 @@
 /* -*-c-*-
- *
- * $Id$
  *
  * Secret sharing
  *
  * (c) 2005 Straylight/Edgeware
  */
 
-/*----- Licensing notice --------------------------------------------------* 
+/*----- Licensing notice --------------------------------------------------*
  *
  * This file is part of the Python interface to Catacomb.
  *
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * Catacomb/Python is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with Catacomb/Python; if not, write to the Free Software Foundation,
  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@@ -65,7 +63,7 @@ static PyGetSetDef gfshare_pygetset[]= {
 
 static PyTypeObject gfshare_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.GFShare",                  /* @tp_name@ */
+  "GFShare",                           /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -95,7 +93,7 @@ static PyTypeObject gfshare_pytype_skel = {
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   0,                                   /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   gfshare_pygetset,                    /* @tp_getset@ */
@@ -115,7 +113,7 @@ static PyObject *gfsharesplit_pynew(PyTypeObject *ty,
                                    PyObject *arg, PyObject *kw)
 {
   char *p;
-  int n;
+  Py_ssize_t n;
   unsigned t;
   grand *r = &rand_global;
   gfshare_pyobj *s;
@@ -153,7 +151,7 @@ static PyMethodDef gfsharesplit_pymethods[] = {
 
 static PyTypeObject gfsharesplit_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.GFShareSplit",             /* @tp_name@ */
+  "GFShareSplit",                      /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -176,14 +174,15 @@ static PyTypeObject gfsharesplit_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Binary field secret sharing: split secret into shares.",
+"GFShareSplit(THRESHOLD, SECRET, [rng = rand]): binary-field sharing:\n\
+   split secret into shares.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   gfsharesplit_pymethods,              /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   0,                                   /* @tp_getset@ */
@@ -230,7 +229,7 @@ static PyObject *gfsmeth_add(PyObject *me, PyObject *arg)
 {
   unsigned i;
   char *p;
-  int n;
+  Py_ssize_t n;
   if (!PyArg_ParseTuple(arg, "O&s#:add", convuint, &i, &p, &n)) goto end;
   if (i > 254) VALERR("index must be < 255");
   if (n != GFSHARE_S(me)->sz) VALERR("bad share size");
@@ -274,7 +273,7 @@ static PyGetSetDef gfsharejoin_pygetset[]= {
 
 static PyTypeObject gfsharejoin_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.GFShareJoin",              /* @tp_name@ */
+  "GFShareJoin",                       /* @tp_name@ */
   sizeof(gfshare_pyobj),               /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -297,14 +296,15 @@ static PyTypeObject gfsharejoin_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Binary field secret sharing: join shares to recover secret.",
+"GFShareJoin(THRESHOLD, SIZE): binary field sharing:\n\
+  join shares to recover secret.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   gfsharejoin_pymethods,               /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   gfsharejoin_pygetset,                        /* @tp_getset@ */
@@ -355,7 +355,7 @@ static PyGetSetDef share_pygetset[]= {
 
 static PyTypeObject share_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.Share",                    /* @tp_name@ */
+  "Share",                             /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -385,7 +385,7 @@ static PyTypeObject share_pytype_skel = {
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   0,                                   /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   share_pygetset,                      /* @tp_getset@ */
@@ -410,7 +410,7 @@ static PyObject *sharesplit_pynew(PyTypeObject *ty,
   mp *m = 0;
   share_pyobj *s;
   char *kwlist[] = { "threshold", "secret", "modulus", "rng", 0 };
-  if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&)&|O&O&:new", kwlist,
+  if (!PyArg_ParseTupleAndKeywords(arg, kw, "O&O&|O&O&:new", kwlist,
                                   convuint, &t, convmp, &sec,
                                   convmp, &m, convgrand, &r))
     goto end;
@@ -446,7 +446,7 @@ static PyMethodDef sharesplit_pymethods[] = {
 
 static PyTypeObject sharesplit_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.ShareSplit",               /* @tp_name@ */
+  "ShareSplit",                                /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -469,14 +469,15 @@ static PyTypeObject sharesplit_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"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@ */
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   sharesplit_pymethods,                        /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   0,                                   /* @tp_getset@ */
@@ -569,7 +570,7 @@ static PyGetSetDef sharejoin_pygetset[]= {
 
 static PyTypeObject sharejoin_pytype_skel = {
   PyObject_HEAD_INIT(&PyType_Type) 0,  /* Header */
-  "catacomb.ShareJoin",                        /* @tp_name@ */
+  "ShareJoin",                         /* @tp_name@ */
   sizeof(share_pyobj),                 /* @tp_basicsize@ */
   0,                                   /* @tp_itemsize@ */
 
@@ -592,14 +593,15 @@ static PyTypeObject sharejoin_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Prime field secret sharing: join shares to recover secret.",
+"ShareJoin(THRESHOLD, MODULUS): prime field secret sharing:\n\
+  join shares to recover secret.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
   0,                                   /* @tp_richcompare@ */
   0,                                   /* @tp_weaklistoffset@ */
   0,                                   /* @tp_iter@ */
-  0,                                   /* @tp_iternexr@ */
+  0,                                   /* @tp_iternext@ */
   sharejoin_pymethods,                 /* @tp_methods@ */
   0,                                   /* @tp_members@ */
   sharejoin_pygetset,                  /* @tp_getset@ */