From 998419575fb34dd5228cfdb353a73184e29db8da Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 30 Sep 2016 14:48:11 -0700 Subject: [PATCH] crypto/ecdsa: correct code comment. The code comment mixed up max and min. In this case, min is correct because this entropy is only used to make the signature scheme probabilistic. (I.e. if it were fixed then the scheme would still be secure except that key.Sign(foo) would always give the same result for a fixed key and foo.) For this purpose, 256-bits is plenty. Fixes #16819. Change-Id: I309bb312b775cf0c4b7463c980ba4b19ad412c36 Reviewed-on: https://go-review.googlesource.com/30153 Run-TryBot: Adam Langley TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/crypto/ecdsa/ecdsa.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go index 72fb49934f..02848fd595 100644 --- a/src/crypto/ecdsa/ecdsa.go +++ b/src/crypto/ecdsa/ecdsa.go @@ -149,7 +149,7 @@ var errZeroParam = errors.New("zero parameter") // returns the signature as a pair of integers. The security of the private key // depends on the entropy of rand. func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) { - // Get max(log2(q) / 2, 256) bits of entropy from rand. + // Get min(log2(q) / 2, 256) bits of entropy from rand. entropylen := (priv.Curve.Params().BitSize + 7) / 16 if entropylen > 32 { entropylen = 32 -- 2.48.1