~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
catacomb/__init__.py: Implement equality and hashing for `KeyData' objects.
[catacomb-python]
/
ec.c
diff --git
a/ec.c
b/ec.c
index
a67699e
..
c9707b7
100644
(file)
--- a/
ec.c
+++ b/
ec.c
@@
-251,10
+251,10
@@
static PyObject *epmeth_tobuf(PyObject *me)
else
n = mp_octets(p.x) + mp_octets(p.y) + 6;
rc = bytestring_pywrap(0, n);
else
n = mp_octets(p.x) + mp_octets(p.y) + 6;
rc = bytestring_pywrap(0, n);
- buf_init(&b,
PyString_AS_STRING
(rc), n);
+ buf_init(&b,
BIN_PTR
(rc), n);
buf_putec(&b, &p);
assert(BOK(&b));
buf_putec(&b, &p);
assert(BOK(&b));
-
_PyString_Resize(&
rc, BLEN(&b));
+
BIN_SETLEN(
rc, BLEN(&b));
EC_DESTROY(&p);
return (rc);
}
EC_DESTROY(&p);
return (rc);
}
@@
-270,12
+270,12
@@
static PyObject *epmeth_toraw(PyObject *me)
len = c->f->noctets * 2 + 1;
rc = bytestring_pywrap(0, len);
len = c->f->noctets * 2 + 1;
rc = bytestring_pywrap(0, len);
- p =
PyString_AS_STRING
(rc);
+ p =
BIN_PTR
(rc);
buf_init(&b, p, len);
EC_OUT(c, &pp, ECPT_P(me));
ec_putraw(c, &b, &pp);
EC_DESTROY(&pp);
buf_init(&b, p, len);
EC_OUT(c, &pp, ECPT_P(me));
ec_putraw(c, &b, &pp);
EC_DESTROY(&pp);
-
_PyString_Resize(&
rc, BLEN(&b));
+
BIN_SETLEN(
rc, BLEN(&b));
return (rc);
}
return (rc);
}
@@
-295,7
+295,7
@@
static PyObject *epmeth_ec2osp(PyObject *me, PyObject *arg, PyObject *kw)
return (0);
len = c->f->noctets * 2 + 1;
rc = bytestring_pywrap(0, len);
return (0);
len = c->f->noctets * 2 + 1;
rc = bytestring_pywrap(0, len);
- p =
PyString_AS_STRING
(rc);
+ p =
BIN_PTR
(rc);
buf_init(&b, p, len);
EC_OUT(c, &pp, ECPT_P(me));
if (ec_ec2osp(c, f, &b, &pp)) {
buf_init(&b, p, len);
EC_OUT(c, &pp, ECPT_P(me));
if (ec_ec2osp(c, f, &b, &pp)) {
@@
-303,7
+303,7
@@
static PyObject *epmeth_ec2osp(PyObject *me, PyObject *arg, PyObject *kw)
VALERR("invalid flags");
}
EC_DESTROY(&pp);
VALERR("invalid flags");
}
EC_DESTROY(&pp);
-
_PyString_Resize(&
rc, BLEN(&b));
+
BIN_SETLEN(
rc, BLEN(&b));
end:
return (rc);
}
end:
return (rc);
}
@@
-516,8
+516,8
@@
static int ecptxl_1(ec_curve *c, ec *p, PyObject *x)
else if (ECPT_PYCHECK(x)) {
getecptout(p, x);
goto fix;
else if (ECPT_PYCHECK(x)) {
getecptout(p, x);
goto fix;
- } else if (
PyString_Check
(x)) {
- qd.p =
PyString_AS_STRING
(x);
+ } else if (
TEXT_CHECK
(x)) {
+ qd.p =
TEXT_PTR
(x);
qd.e = 0;
if (!ec_ptparse(&qd, p))
VALERR(qd.e);
qd.e = 0;
if (!ec_ptparse(&qd, p))
VALERR(qd.e);
@@
-1028,7
+1028,7
@@
end:
}
static PyObject *ecget_name(PyObject *me, void *hunoz)
}
static PyObject *ecget_name(PyObject *me, void *hunoz)
- { return (
PyString_FromString
(EC_NAME(ECCURVE_C(me)))); }
+ { return (
TEXT_FROMSTR
(EC_NAME(ECCURVE_C(me)))); }
static PyObject *ecget_a(PyObject *me, void *hunoz)
{ return (fe_pywrap(ECCURVE_FOBJ(me), MP_COPY(ECCURVE_C(me)->a))); }
static PyObject *ecget_a(PyObject *me, void *hunoz)
{ return (fe_pywrap(ECCURVE_FOBJ(me), MP_COPY(ECCURVE_C(me)->a))); }