summaryrefslogtreecommitdiff
path: root/src/lib/libc/stdlib/reallocarray.c
diff options
context:
space:
mode:
authortb <>2024-11-30 16:18:01 +0000
committertb <>2024-11-30 16:18:01 +0000
commita6c5e92ff8006052ab380ce91bd003b45d6eb794 (patch)
tree8e412cf44f05ab80a79f627987d104e6c89f2753 /src/lib/libc/stdlib/reallocarray.c
parent3f6eb9bb1205bfa957d4cfefd8e4f33fd954952a (diff)
downloadopenbsd-a6c5e92ff8006052ab380ce91bd003b45d6eb794.tar.gz
openbsd-a6c5e92ff8006052ab380ce91bd003b45d6eb794.tar.bz2
openbsd-a6c5e92ff8006052ab380ce91bd003b45d6eb794.zip
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 <bodo@openssl.org> 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: emilia@openssl.org
Diffstat (limited to 'src/lib/libc/stdlib/reallocarray.c')
0 files changed, 0 insertions, 0 deletions