crypto/elliptic: use a const string for precomputed P256 table
Const strings can be marked readonly. This is particularly important for this relatively large table (88kb). This is a follow-up to CL 315189. The generation script is a bit awkward. It needs access to crypto/elliptic internals, but also needs to be package main. Work around this by exporting those internals with the "tablegen" build tag. This requires changing the function signature at the Go-asm bridge. As long as we're here, shrink the point argument type as well; the net result is three fewer words of params. Performance impact is probably noise. name old time/op new time/op delta ScalarBaseMult/P256-8 11.4µs ± 2% 11.3µs ± 1% -1.32% (p=0.000 n=19+16) ScalarBaseMult/P224-8 579µs ± 1% 577µs ± 0% -0.30% (p=0.024 n=19+20) ScalarBaseMult/P384-8 2.31ms ± 4% 2.34ms ± 4% +1.25% (p=0.033 n=20+20) ScalarBaseMult/P521-8 1.33ms ± 0% 1.33ms ± 1% ~ (p=0.173 n=18+17) ScalarMult/P256-8 42.7µs ± 0% 42.7µs ± 2% ~ (p=0.989 n=20+20) ScalarMult/P224-8 579µs ± 0% 579µs ± 0% ~ (p=0.538 n=19+18) ScalarMult/P384-8 2.32ms ± 3% 2.34ms ± 5% ~ (p=0.235 n=19+20) ScalarMult/P521-8 1.33ms ± 1% 1.34ms ± 2% ~ (p=0.141 n=17+20) Change-Id: I3bee56df34ae61ca8829791d2e67e058ecc8ddbe Reviewed-on: https://go-review.googlesource.com/c/go/+/339591 Trust: Josh Bleecher Snyder <josharian@gmail.com> Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by:Roland Shoemaker <roland@golang.org> Reviewed-by:
Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by:
Filippo Valsorda <filippo@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
Loading
Please sign in to comment