+static PyObject *epmeth_ec2osp(PyObject *me, PyObject *arg, PyObject *kw)
+{
+ buf b;
+ PyObject *rc;
+ char *p;
+ ec_curve *c = ECPT_C(me);
+ ec pp = EC_INIT;
+ unsigned f = EC_EXPLY;
+ int len;
+ char *kwlist[] = { "flags", 0 };
+
+ if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:ec2osp", kwlist,
+ convuint, &f))
+ return (0);
+ len = c->f->noctets * 2 + 1;
+ rc = bytestring_pywrap(0, len);
+ p = PyString_AS_STRING(rc);
+ buf_init(&b, p, len);
+ EC_OUT(c, &pp, ECPT_P(me));
+ if (ec_ec2osp(c, f, &b, &pp)) {
+ Py_DECREF(rc); rc = 0;
+ VALERR("invalid flags");
+ }
+ EC_DESTROY(&pp);
+ _PyString_Resize(&rc, BLEN(&b));
+end:
+ return (rc);
+}
+