go/src/crypto
Josh Bleecher Snyder e5c512520b 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>
2021-10-26 23:06:10 +00:00
..
aes all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
cipher all: add //go:build lines to assembly files 2021-05-13 09:12:17 +00:00
des
dsa
ecdsa all: use bytes.Cut, strings.Cut 2021-10-06 15:53:04 +00:00
ed25519 all: fix typos 2021-08-17 13:54:10 +00:00
elliptic crypto/elliptic: use a const string for precomputed P256 table 2021-10-26 23:06:10 +00:00
hmac
internal all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
md5 crypto: avoid escaping Hash.Sum on generic architectures 2021-09-23 16:54:46 +00:00
rand crypto/rand: document additional getrandom/getentropy support in Reader 2021-10-05 07:32:41 +00:00
rc4
rsa crypto/rsa: fix salt length calculation with PSSSaltLengthAuto 2021-03-29 15:20:11 +00:00
sha1 crypto: avoid escaping Hash.Sum on generic architectures 2021-09-23 16:54:46 +00:00
sha256 crypto: avoid escaping Hash.Sum on generic architectures 2021-09-23 16:54:46 +00:00
sha512 crypto: avoid escaping Hash.Sum on generic architectures 2021-09-23 16:54:46 +00:00
subtle
tls crypto/tls: add Conn.NetConn method 2021-10-25 18:46:45 +00:00
x509 crypto/x509: generate new-style build tags for iOS 2021-10-26 22:05:53 +00:00
crypto.go crypto: document the extended key interfaces 2021-09-30 15:20:44 +00:00
issue21104_test.go