CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]    2024/11/30 09:18:01

Modified files:
        lib/libcrypto/ec: ecp_methods.c 

Log message:
Improve ec_points_make_affine()

It is unclear how the original code was supposed to work. It clearly
missed a few corner cases (like handling points at infinity correctly)
and the badly mangled comment that was supposed to display a binary
search tree didn't help at all.

Instead do something much more straightforward: multiply all the non-zero
Z coordinates of the points not at infinity together, keeping track of the
intermediate products. Then do a single expensive modular inversion before
working backwards to compute all the inverses. Then the transformation from
Jacobian coordinates to affine coordiantes (x, y, z) -> (x/z^2, y/z^3, 1)
becomes cheap. A little bit of care has to be taken for Montgomery curves
but that's very simple compared to the mess that was there before.

ok jsing

This is a cleaned up version of:

commit 0fe73d6c3641cb175871463bdddbbea3ee0b62ae
Author: Bodo Moeller <[email protected]>
Date:   Fri Aug 1 17:18:14 2014 +0200

Simplify and fix ec_GFp_simple_points_make_affine
(which didn't always handle value 0 correctly).

Reviewed-by: [email protected]

Reply via email to