From c8b711c464a1feeef847453571d798bb60a94c51 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 12 Oct 2019 13:44:54 +0100 Subject: [PATCH] ec.c (ec2osp, os2ecp): Collect flags correctly. Previously `ec2osp' collected an `int', which probably wasn't completely terrible, and `os2ecp' collected a float, which probably was. --- ec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ec.c b/ec.c index 7fd369d..4ee4d05 100644 --- a/ec.c +++ b/ec.c @@ -298,11 +298,12 @@ static PyObject *epmeth_ec2osp(PyObject *me, PyObject *arg, PyObject *kw) char *p; ec_curve *c = ECPT_C(me); ec pp = EC_INIT; - int f = EC_EXPLY; + unsigned f = EC_EXPLY; int len; char *kwlist[] = { "flags", 0 }; - if (!PyArg_ParseTupleAndKeywords(arg, kw, "|i:ec2osp", kwlist, &f)) + if (!PyArg_ParseTupleAndKeywords(arg, kw, "|O&:ec2osp", kwlist, + convuint, &f)) return (0); len = c->f->noctets * 2 + 1; rc = bytestring_pywrap(0, len); @@ -866,12 +867,12 @@ static PyObject *meth__ECPtCurve_os2ecp(PyObject *me, buf b; PyObject *rc = 0; ec_curve *cc; - int f = EC_XONLY | EC_LSB | EC_SORT | EC_EXPLY; + 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#|f:os2ecp", kwlist, - &me, &p, &len, &f)) + 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); -- 2.11.0