-/* --- @ec_imul@, @ec_mul@ --- *
- *
- * Arguments: @ec_curve *c@ = pointer to an elliptic curve
- * @ec *d@ = pointer to the destination point
- * @const ec *p@ = pointer to the generator point
- * @mp *n@ = integer multiplier
- *
- * Returns: The destination @d@.
- *
- * Use: Multiplies a point by a scalar, returning %$n p$%. The
- * @imul@ variant uses internal representations for argument
- * and result.
- */
-
-ec *ec_imul(ec_curve *c, ec *d, const ec *p, mp *n)
-{
- ec t = EC_INIT;
-
- EC_COPY(&t, p);
- if (t.x && (n->f & MP_BURN))
- t.x->f |= MP_BURN;
- MP_SHRINK(n);
- EC_SETINF(d);
- if (MP_LEN(n) == 0)
- ;
- else {
- if (n->f & MP_NEG)
- EC_NEG(c, &t, &t);
- if (MP_LEN(n) < EXP_THRESH)
- EXP_SIMPLE(*d, t, n);
- else
- EXP_WINDOW(*d, t, n);
- }
- EC_DESTROY(&t);
- return (d);
-}
-
-ec *ec_mul(ec_curve *c, ec *d, const ec *p, mp *n)
-{
- EC_IN(c, d, p);
- ec_imul(c, d, d, n);
- return (EC_OUT(c, d, d));
-}
-