/* -*-c-*-
*
- * $Id$
- *
* Elliptic curves
*
* (c) 2004 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.
static PyObject *epmeth_oncurvep(PyObject *me, PyObject *arg)
{
if (!PyArg_ParseTuple(arg, ":oncurvep")) return (0);
- return (getbool(!ec_check(ECPT_C(me), ECPT_P(me))));
+ return (getbool(EC_ATINF(ECPT_P(me)) ||
+ !EC_CHECK(ECPT_C(me), ECPT_P(me))));
}
static PyObject *epmeth_dbl(PyObject *me, PyObject *arg)
{
ec_mulfactor *f = pp;
+ EC_CREATE(&f->base);
if (getecpt(ECCURVE_C(me), &f->base, x) ||
(f->exp = getmp(m)) == 0)
return (-1);
- f->base = *ECPT_P(x);
return (0);
}
static PyObject *ecget_a(PyObject *me, void *hunoz)
{ return (fe_pywrap(ECCURVE_FOBJ(me), MP_COPY(ECCURVE_C(me)->a))); }
-static PyObject *ecget_b(PyObject *me, void *hunoz)
+static PyObject *ecget_b(PyObject *me, void *hunoz)
{ return (fe_pywrap(ECCURVE_FOBJ(me), MP_COPY(ECCURVE_C(me)->b))); }
static PyObject *ecget_field(PyObject *me, void *hunoz)
GET (inf, "E.inf -> point at infinity of this curve")
#undef GETSETNAME
{ 0 }
-};
+};
static PyMethodDef eccurve_pymethods[] = {
#define METHNAME(name) ecmeth_##name
static PyMethodDef methods[] = {
#define METHNAME(func) meth_##func
- METH (_ECPt_frombuf, "frombuf(E, STR) -> (P, REST)")
- METH (_ECPtCurve_fromraw, "fromraw(E, STR) -> (P, REST)")
- METH (_ECPt_parse, "parse(E, STR) -> (P, REST)")
- METH (_ECCurve_parse, "parse(STR) -> (E, REST)")
- METH (_ECInfo_parse, "parse(STR) -> (I, REST)")
- METH (_ECInfo__curven, "_curven(N) -> I")
+ METH (_ECPt_frombuf, "frombuf(E, STR) -> (P, REST)")
+ METH (_ECPtCurve_fromraw, "fromraw(E, STR) -> (P, REST)")
+ METH (_ECPt_parse, "parse(E, STR) -> (P, REST)")
+ METH (_ECCurve_parse, "parse(STR) -> (E, REST)")
+ METH (_ECInfo_parse, "parse(STR) -> (I, REST)")
+ METH (_ECInfo__curven, "_curven(N) -> I")
#undef METHNAME
{ 0 }
};
}
c = PyInt_FromLong(i);
found:
- PyDict_SetItemString(d, (/*unconst*/ char *)ectab[i].name, c);
+ PyDict_SetItemString(d, (/*unconst*/ char *)p, c);
Py_DECREF(c);
}
ncurves = i;