-
- Downloads
Preserve zero denominators in ECC point normalisation.
ecc_montgomery_normalise takes a point with X and Z coordinates, and normalises it to Z=1 by means of multiplying X by the inverse of Z and then setting Z=1. If you pass in a point with Z=0, representing the curve identity, then it would be nice to still get the identity back out again afterwards. We haven't really needed that property until now, but I'm about to want it. Currently, what happens is that we try to invert Z mod p; fail, but don't notice we've failed, and come out with some nonsense value as the inverse; multiply X by that; and then _set Z to 1_. So the output value no longer has Z=0. This commit changes things so that we multiply Z by the inverse we computed. That way, if Z started off 0, it stays 0. Also made the same change in the other two curve types, on general principles, though I don't yet have a use for that.
Loading
Please register or sign in to comment