secp256k1 icon indicating copy to clipboard operation
secp256k1 copied to clipboard

Faster const-time normalization

Open peterdettman opened this issue 2 years ago • 0 comments

Use a "borrowing" trick in _fe_normalize to simplify the handling of values in [P, 2^256). This is significantly faster too (according to bench_internal), though performance of _fe_normalize isn't that important.

Applying a similar idea to _fe_normalizes_to_zero also results in a performance boost, and in this case it appears to boost signing speed by 2% or more (also ECDH), due to three calls in _gej_add_ge.

peterdettman avatar Dec 03 '21 13:12 peterdettman