mirror of
https://github.com/golang/go.git
synced 2025-05-29 03:11:26 +00:00
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 <agl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
49aa1d791b
commit
998419575f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user