dalek-cryptography / curve25519-dalek

A pure-Rust implementation of group operations on Ristretto and Curve25519
Other
850 stars 416 forks source link

Potential optimization for the torsion check #651

Open randombit opened 2 months ago

randombit commented 2 months ago

Currently the torsion check (is_torsion_free) is implemented using a variable base constant time multiplication. However the group order is public so there is no need for side channel countermeasures regarding the scalar. This would save the overhead from LookupTable::select, both the constant time lookup as well as the cost of doing the point negation in the case it's not needed. You could also precompute the NAF encoding of the group order, though I'm not sure if that's worthwhile.

randombit commented 1 month ago

https://github.com/dalek-cryptography/curve25519-dalek/pull/657