diff options
author | Filippo Valsorda <filippo@golang.org> | 2020-02-10 17:29:13 -0500 |
---|---|---|
committer | Filippo Valsorda <filippo@golang.org> | 2020-02-11 00:59:47 +0000 |
commit | 25da21ddc935f1af1b10361c52984ddaaade9265 (patch) | |
tree | de130884490e0787725b2ac452c715de53e69b6a | |
parent | ab5d9f5831cd267e0d8e8954cfe9987b737aec9c (diff) | |
download | go-25da21ddc935f1af1b10361c52984ddaaade9265.tar.gz go-25da21ddc935f1af1b10361c52984ddaaade9265.zip |
crypto/elliptic: document the Name and names of each curve
See https://tools.ietf.org/html/rfc8422#appendix-A for a helpful table.
Also, commit to keeping them singletons, as that assumption is already
made all over the place in the ecosystem.
Fixes #34193
Change-Id: I2ec50fa18bb80e11d6101f2562df60b5e27d4f66
Reviewed-on: https://go-review.googlesource.com/c/go/+/218921
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
-rw-r--r-- | src/crypto/elliptic/elliptic.go | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/crypto/elliptic/elliptic.go b/src/crypto/elliptic/elliptic.go index c84657c5e3..e2f71cdb63 100644 --- a/src/crypto/elliptic/elliptic.go +++ b/src/crypto/elliptic/elliptic.go @@ -372,7 +372,12 @@ func initP521() { p521.BitSize = 521 } -// P256 returns a Curve which implements P-256 (see FIPS 186-3, section D.2.3) +// P256 returns a Curve which implements NIST P-256 (FIPS 186-3, section D.2.3), +// also known as secp256r1 or prime256v1. The CurveParams.Name of this Curve is +// "P-256". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. // // The cryptographic operations are implemented using constant-time algorithms. func P256() Curve { @@ -380,7 +385,11 @@ func P256() Curve { return p256 } -// P384 returns a Curve which implements P-384 (see FIPS 186-3, section D.2.4) +// P384 returns a Curve which implements NIST P-384 (FIPS 186-3, section D.2.4), +// also known as secp384r1. The CurveParams.Name of this Curve is "P-384". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. // // The cryptographic operations do not use constant-time algorithms. func P384() Curve { @@ -388,7 +397,11 @@ func P384() Curve { return p384 } -// P521 returns a Curve which implements P-521 (see FIPS 186-3, section D.2.5) +// P521 returns a Curve which implements NIST P-521 (FIPS 186-3, section D.2.5), +// also known as secp521r1. The CurveParams.Name of this Curve is "P-521". +// +// Multiple invocations of this function will return the same value, so it can +// be used for equality checks and switch statements. // // The cryptographic operations do not use constant-time algorithms. func P521() Curve { |