]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/ecdsa: correct code comment.
authorAdam Langley <agl@golang.org>
Fri, 30 Sep 2016 21:48:11 +0000 (14:48 -0700)
committerAdam Langley <agl@golang.org>
Sun, 2 Oct 2016 19:38:37 +0000 (19:38 +0000)
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 <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/crypto/ecdsa/ecdsa.go

index 72fb49934fcc63e540fc21638397ed0c8e5f126f..02848fd5954f81826ad1b8ba2700481fb26268e6 100644 (file)
@@ -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