[PATCH 6/8] mpi:ec: Use affine coordinate for mpi_ec_mul_point_lli.

NIIBE Yutaka gniibe at fsij.org
Fri Mar 28 02:49:32 CET 2025


Hello,

Jacob Bachmeyer <jcb62281 at gmail.com> wrote:
> On 3/27/25 00:19, NIIBE Yutaka via Gcrypt-devel wrote:
>> * mpi/ec.c (add_points_weierstrass_a, add_points_edwards_a): New.
>> (mpi_ec_mul_point_lli): Use those routines directly.
>>
> Found a typo:  "P1 is never same to P1"?

Thank you.

I fixed the comment.  It's now:
==========================
/* RESULT = P1 + P2  (Weierstrass version).
 * P2 is represented by affine coordinate (X2,Y2).
 * P1 is never same to P2.
 * P1 may be at infinity, in this case, it results invalid RESULT.
 * It's caller's responsibility not to use the invalid RESULT.  */
static void
add_points_weierstrass_a (mpi_point_t result,
==========================

Before the change, we use general "add two points" routine of

	(X1:Y1:Z1) + (X2:Y2:Z2) -> (X3:Y3:Z3)

for "multiplying a point".

We can put the assumption of Z2 == 1 for the computation of "multiplying
a point", and the computation can be done simpler.

(In future) we could introduce more efficient ECC multiplying routine
with precomputed table lookup.  This improvement allows the table of
(X, Y) which is smaller than the table of (X:Y:Z).
-- 



More information about the Gcrypt-devel mailing list