]> Cypherpunks repositories - gostls13.git/commitdiff
math/big: add security warning to (*Int).Rand
authorFilippo Valsorda <hi@filippo.io>
Sun, 5 Nov 2017 19:33:21 +0000 (14:33 -0500)
committerFilippo Valsorda <hi@filippo.io>
Mon, 6 Nov 2017 15:55:31 +0000 (15:55 +0000)
Change-Id: I22a67733aa2d07298e124077654c9b1473802100
Reviewed-on: https://go-review.googlesource.com/76012
Reviewed-by: Aliaksandr Valialkin <valyala@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/math/big/int.go

index 224551483506104387f6c5c4a018e325ff632b70..a89f7a2d17266aa4977c11707c81ababf0efe178 100644 (file)
@@ -644,6 +644,9 @@ func (z *Int) lehmerGCD(a, b *Int) *Int {
 }
 
 // Rand sets z to a pseudo-random number in [0, n) and returns z.
+//
+// As this uses the math/rand package, it must not be used for
+// security-sensitive work. Use crypto/rand.Int instead.
 func (z *Int) Rand(rnd *rand.Rand, n *Int) *Int {
        z.neg = false
        if n.neg || len(n.abs) == 0 {