~mdw
/
catacomb-python
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pubkey.c (RSAPriv): Fix segfault if `p' is provided but not `q'.
[catacomb-python]
/
ec.c
diff --git
a/ec.c
b/ec.c
index
1bf24cf
..
30dc50c
100644
(file)
--- a/
ec.c
+++ b/
ec.c
@@
-206,15
+206,13
@@
static long ecpt_pyhash(PyObject *me)
static PyObject *ecpt_pyrichcompare(PyObject *x, PyObject *y, int op)
{
static PyObject *ecpt_pyrichcompare(PyObject *x, PyObject *y, int op)
{
- ec_curve *c;
- PyObject *cobj;
ec p = EC_INIT, q = EC_INIT;
int b;
PyObject *rc = 0;
ec p = EC_INIT, q = EC_INIT;
int b;
PyObject *rc = 0;
- if (
ecbinop(x, y, &c, &cobj, &p, &q
)) RETURN_NOTIMPL;
-
EC_OUT(c, &p, &p
);
-
EC_OUT(c, &q, &q
);
+ if (
!ECPT_PYCHECK(y
)) RETURN_NOTIMPL;
+
getecptout(&p, x
);
+
getecptout(&q, y
);
switch (op) {
case Py_EQ: b = EC_EQ(&p, &q); break;
case Py_NE: b = !EC_EQ(&p, &q); break;
switch (op) {
case Py_EQ: b = EC_EQ(&p, &q); break;
case Py_NE: b = !EC_EQ(&p, &q); break;
@@
-455,7
+453,7
@@
static int ecptxl_1(ec_curve *c, ec *p, PyObject *x)
getecptout(p, x);
goto fix;
} else if (PyString_Check(x)) {
getecptout(p, x);
goto fix;
} else if (PyString_Check(x)) {
- if (PyObject_AsReadBuffer(x, &q,
0
))
+ if (PyObject_AsReadBuffer(x, &q,
&n
))
goto end;
qd.p = q;
qd.e = 0;
goto end;
qd.p = q;
qd.e = 0;
@@
-1065,7
+1063,7
@@
static PyMethodDef eccurve_pymethods[] = {
METH (mmul, "\
E.mmul([(P0, N0), (P1, N1), ...]) = N0 P0 + N1 P1 + ...")
METH (find, "E.find(X) -> P")
METH (mmul, "\
E.mmul([(P0, N0), (P1, N1), ...]) = N0 P0 + N1 P1 + ...")
METH (find, "E.find(X) -> P")
- KWMETH(rand, "E.rand(
rng = rand) ->
P")
+ KWMETH(rand, "E.rand(
[rng = rand]) ->
P")
#undef METHNAME
{ 0 }
};
#undef METHNAME
{ 0 }
};
@@
-1486,7
+1484,7
@@
static PyGetSetDef ecinfo_pygetset[] = {
static PyMethodDef ecinfo_pymethods[] = {
#define METHNAME(name) eimeth_##name
static PyMethodDef ecinfo_pymethods[] = {
#define METHNAME(name) eimeth_##name
- KWMETH(check, "I.check() -> None")
+ KWMETH(check, "I.check(
[rng = rand]
) -> None")
#undef METHNAME
{ 0 }
};
#undef METHNAME
{ 0 }
};