-static PyObject *meth__ECPtCurve_fromraw(PyObject *me, PyObject *arg)
-{
- char *p;
- Py_ssize_t len;
- buf b;
- PyObject *rc = 0;
- ec_curve *cc;
- ec pp = EC_INIT;
-
- if (!PyArg_ParseTuple(arg, "Os#:fromraw", &me, &p, &len))
- return (0);
- buf_init(&b, p, len);
- cc = ECCURVE_C(me);
- if (ec_getraw(cc, &b, &pp))
- VALERR("bad point");
- EC_IN(cc, &pp, &pp);
- rc = Py_BuildValue("(NN)", ecpt_pywrap(me, &pp), bytestring_pywrapbuf(&b));
-end:
- return (rc);
-}
-
-static PyObject *meth__ECPtCurve_os2ecp(PyObject *me,
- PyObject *arg, PyObject *kw)
-{
- char *p;
- Py_ssize_t len;
- buf b;
- PyObject *rc = 0;
- ec_curve *cc;
- unsigned f = EC_XONLY | EC_LSB | EC_SORT | EC_EXPLY;
- ec pp = EC_INIT;
- char *kwlist[] = { "class", "buf", "flags", 0 };
-
- if (!PyArg_ParseTupleAndKeywords(arg, kw, "Os#|O&:os2ecp", kwlist,
- &me, &p, &len, convuint, &f))
- return (0);
- buf_init(&b, p, len);
- cc = ECCURVE_C(me);
- if (ec_os2ecp(cc, f, &b, &pp)) VALERR("bad point");
- EC_IN(cc, &pp, &pp);
- rc = Py_BuildValue("(NN)", ecpt_pywrap(me, &pp), bytestring_pywrapbuf(&b));
-end:
- return (rc);
-}
-
-static PyObject *meth__ECPt_frombuf(PyObject *me, PyObject *arg)
-{
- buf b;
- char *p;
- Py_ssize_t sz;
- PyObject *rc = 0;
- ec pp = EC_INIT;
-
- if (!PyArg_ParseTuple(arg, "Os#:frombuf", &me, &p, &sz)) goto end;
- buf_init(&b, p, sz);
- if (buf_getec(&b, &pp)) VALERR("malformed data");
- rc = Py_BuildValue("(NN)", ecpt_pywrapout(me, &pp),
- bytestring_pywrapbuf(&b));
-end:
- return (rc);
-}
-
-static PyObject *meth__ECPt_parse(PyObject *me, PyObject *arg)
-{
- char *p;
- qd_parse qd;
- PyObject *rc = 0;
- ec pp = EC_INIT;
-
- if (!PyArg_ParseTuple(arg, "Os:parse", &me, &p)) goto end;
- qd.p = p;
- qd.e = 0;
- if (!ec_ptparse(&qd, &pp)) VALERR(qd.e);
- rc = Py_BuildValue("(Ns)", ecpt_pywrapout(me, &pp), qd.p);
-end:
- return (rc);
-}
-