chiark / gitweb /
debian/: Use `dh_python2' for packaging.
[catacomb-python] / algorithms.c
index 0f05f75f9a6db348e467479dd953492668132160..7eab3ae4571c9cb1fe543b7a591621808d9b4180 100644 (file)
@@ -107,11 +107,9 @@ static PyObject *keyszrange_pynew(PyTypeObject *ty,
   if (!PyArg_ParseTupleAndKeywords(arg, kw, "i|iii:new", kwlist,
                                   &dfl, &min, &max, &mod))
     goto end;
-  if (dfl < 0 || min < 0 || max < 0)
-    VALERR("key size cannot be negative");
-  if (min > dfl || (max && dfl > max))
-    VALERR("bad key size bounds");
-  if (mod <= 0 || dfl % mod || min % mod || max % mod)
+  if (dfl < 0 || min < 0) VALERR("key size cannot be negative");
+  if (min > dfl || (max && dfl > max)) VALERR("bad key size bounds");
+  if (mod <= 0 || dfl%mod || min%mod || max%mod)
     VALERR("bad key size modulus");
   o = (keyszrange_pyobj *)ty->tp_alloc(ty, 0);
   o->dfl = dfl;
@@ -132,8 +130,7 @@ static PyObject *keyszset_pynew(PyTypeObject *ty,
   PyObject *x = 0, *l = 0;
   keyszset_pyobj *o = 0;
 
-  if (!PyArg_ParseTupleAndKeywords(arg, kw, "i|O:new", kwlist,
-                                         &dfl, &set))
+  if (!PyArg_ParseTupleAndKeywords(arg, kw, "i|O:new", kwlist, &dfl, &set))
     goto end;
   if (!set) set = PyTuple_New(0);
   else Py_INCREF(set);
@@ -264,7 +261,7 @@ static PyTypeObject keysz_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Key size constraints.",
+"Key size constraints.  Abstract.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -312,7 +309,8 @@ static PyTypeObject keyszany_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Key size constraints.  This object imposes no constraints on size.",
+"KeySZAny(DEFAULT)\n\
+  Key size constraints.  This object imposes no constraints on size.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -360,8 +358,9 @@ static PyTypeObject keyszrange_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Key size constraints.  This object asserts minimum and maximum (if\n\
-sizes, and requires the key length to be a multiple of some value.",
+"KeySZRange(DEFAULT, [min = 0], [max = 0], [mod = 1])\n\
+  Key size constraints.  Key size must be between MIN and MAX inclusive,\n\
+  and be a multiple of MOD.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -409,8 +408,8 @@ static PyTypeObject keyszset_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Key size constraints.  This object requires the key to be one of a\n\
-few listed sizes.",
+"KeySZSet(DEFAULT, SEQ)\n\
+  Key size constraints.  Key size must be DEFAULT or one in SEQ.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -1485,7 +1484,7 @@ static PyTypeObject poly1305key_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Poly1305 key.",
+"poly1305(K): Poly1305 key.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -1722,7 +1721,7 @@ static PyTypeObject kxvik_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"Keccak-p[1600, n] state.",
+"Keccak1600([nround = 24]): Keccak-p[1600, n] state.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -2019,7 +2018,7 @@ static PyTypeObject shake128_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"SHAKE128/cSHAKE128 XOF.",
+"Shake128([perso = STR], [func = STR]): SHAKE128/cSHAKE128 XOF.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */
@@ -2067,7 +2066,7 @@ static PyTypeObject shake256_pytype_skel = {
     Py_TPFLAGS_BASETYPE,
 
   /* @tp_doc@ */
-"SHAKE256/cSHAKE256 XOF.",
+"Shake256([perso = STR], [func = STR]): SHAKE256/cSHAKE256 XOF.",
 
   0,                                   /* @tp_traverse@ */
   0,                                   /* @tp_clear@ */