chiark / gitweb /
ec (ecmeth_mmul): Fix point conversion.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 23 Jun 2008 14:07:58 +0000 (15:07 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 23 Jun 2008 14:07:58 +0000 (15:07 +0100)
Really quite broken.

  * Firstly, the code tried to copy a point to an uninitialized
    destination point, which just isn't a good idea.

  * And secondly, after tediously doing the correct conversion, it just
    tried to copy the raw point over the top of the correct converted
    point.

Not good, really.

ec.c

diff --git a/ec.c b/ec.c
index f31670e3a2f904a6dfab36feba9788d9f3355f1d..9946205994dd33f1d8994146bc1e390956b2e34c 100644 (file)
--- a/ec.c
+++ b/ec.c
@@ -774,10 +774,10 @@ static int ecmmul_fill(void *pp, PyObject *me, PyObject *x, PyObject *m)
 {
   ec_mulfactor *f = pp;
 
+  EC_CREATE(&f->base);
   if (getecpt(ECCURVE_C(me), &f->base, x) ||
       (f->exp = getmp(m)) == 0)
     return (-1);
-  f->base = *ECPT_P(x);
   return (0);
 }