chiark / gitweb /
catacomb/__init__.py: Settle on SHAKE256 for X448 box-key generation.
[catacomb-python] / mp.c
diff --git a/mp.c b/mp.c
index f5f43204a718256abc288f93db7c4aa7907e7804..79c6cf20c8952f6502f68395d28abeab2ebe0202 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -713,7 +713,7 @@ STOREOP(storeb2c, 2c)
   {                                                                    \
     buf b;                                                             \
     char *p;                                                           \
-    int sz;                                                            \
+    Py_ssize_t sz;                                                     \
     PyObject *rc = 0;                                                  \
     mp *x;                                                             \
                                                                        \
@@ -911,7 +911,7 @@ static PyObject *meth__MP_fromstring(PyObject *me,
 {
   int r = 0;
   char *p;
-  int len;
+  Py_ssize_t len;
   PyObject *z = 0;
   mp *zz;
   mptext_stringctx sc;
@@ -924,7 +924,8 @@ static PyObject *meth__MP_fromstring(PyObject *me,
   sc.buf = p; sc.lim = p + len;
   if ((zz = mp_read(MP_NEW, r, &mptext_stringops, &sc)) == 0)
     VALERR("bad integer");
-  z = Py_BuildValue("(Ns#)", mp_pywrap(zz), sc.buf, (int)(sc.lim - sc.buf));
+  z = Py_BuildValue("(Ns#)", mp_pywrap(zz),
+                   sc.buf, (Py_ssize_t)(sc.lim - sc.buf));
 end:
   return (z);
 }
@@ -952,7 +953,7 @@ static PyObject *meth__MP_fibonacci(PyObject *me, PyObject *arg)
   static PyObject *meth__##py##_##name(PyObject *me, PyObject *arg)    \
   {                                                                    \
     char *p;                                                           \
-    int len;                                                           \
+    Py_ssize_t len;                                                    \
     if (!PyArg_ParseTuple(arg, "Os#:" #name, &me, &p, &len)) return (0); \
     return (pre##_pywrap(mp_##name(MP_NEW, p, len)));                  \
   }
@@ -2111,7 +2112,7 @@ static PyObject *meth__GF_fromstring(PyObject *me,
 {
   int r = 0;
   char *p;
-  int len;
+  Py_ssize_t len;
   PyObject *z = 0;
   mp *zz;
   mptext_stringctx sc;
@@ -2127,7 +2128,8 @@ static PyObject *meth__GF_fromstring(PyObject *me,
     if (zz) MP_DROP(zz);
     VALERR("bad binary polynomial");
   }
-  z = Py_BuildValue("(Ns#)", gf_pywrap(zz), sc.buf, (int)(sc.lim - sc.buf));
+  z = Py_BuildValue("(Ns#)", gf_pywrap(zz),
+                   sc.buf, (Py_ssize_t)(sc.lim - sc.buf));
 end:
   return (z);
 }