chiark / gitweb /
catacomb/__init__.py: Settle on SHAKE256 for X448 box-key generation.
[catacomb-python] / ec.c
diff --git a/ec.c b/ec.c
index 6dcf1cb17fa5c85bd99512b9d0fbe0db0721973d..0489bc0f33e3b00d4a882b2be9772fdbaf8c0d17 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -525,8 +525,8 @@ static PyObject *ecpt_pyint(PyObject *me)
   PyObject *rc = 0;
   if (EC_ATINF(ECPT_P(me))) VALERR("point at infinity");
   getecptout(&p, me);
-  if (mp_tolong_checked(p.x, &l)) goto end;
-  rc = PyInt_FromLong(l);
+  if (!mp_tolong_checked(p.x, &l, 0)) rc = PyInt_FromLong(l);
+  else rc = mp_topylong(p.x);
 end:
   EC_DESTROY(&p);
   return (rc);