]> Cypherpunks repositories - gostls13.git/commit
crypto/elliptic: use complete addition formulas for P-521
authorFilippo Valsorda <filippo@golang.org>
Thu, 13 May 2021 19:33:48 +0000 (15:33 -0400)
committerFilippo Valsorda <filippo@golang.org>
Sat, 30 Oct 2021 16:45:25 +0000 (16:45 +0000)
commite39b854a6797a7159602f0d6b351ef35ebfa01d0
tree8cf6aa1ff3e42422a852d8d3e3ee8431c3032daf
parent5d6d9f5610066584374c2dfe7624fa9f251089a0
crypto/elliptic: use complete addition formulas for P-521

Complete formulas don't have exceptions for P = Q or P = 0, which makes
them significantly simpler and safer to implement. Notice how the
constant time IsZero checks are gone.

It's not free, but still well within the performance gains of CL 315271.

name                    old time/op    new time/op    delta
pkg:crypto/elliptic goos:darwin goarch:amd64
ScalarBaseMult/P521-16    1.34ms ± 3%    1.63ms ± 4%  +21.78%  (p=0.000 n=10+10)
ScalarMult/P521-16        1.35ms ± 3%    1.65ms ± 4%  +22.58%  (p=0.000 n=10+10)
pkg:crypto/ecdsa goos:darwin goarch:amd64
Sign/P521-16              1.45ms ± 2%    1.67ms ± 1%  +15.00%  (p=0.000 n=10+8)
Verify/P521-16            2.68ms ± 1%    3.10ms ± 2%  +16.02%  (p=0.000 n=10+9)
GenerateKey/P521-16       1.31ms ± 4%    1.53ms ± 1%  +16.89%  (p=0.000 n=10+9)

Change-Id: Ibd9a961e9865df68a1250aba739c190caf9a54de
Reviewed-on: https://go-review.googlesource.com/c/go/+/320071
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Julie Qiu <julie@golang.org>
src/crypto/elliptic/p521.go