mirror of
https://github.com/golang/go
synced 2024-11-21 21:24:45 -07:00
crypto/ecdsa, crypto/rsa: use io.ReadFull to read from random source.
R=golang-dev, agl1 CC=golang-dev https://golang.org/cl/4316057
This commit is contained in:
parent
db99a784c2
commit
9f1394d270
@ -37,7 +37,7 @@ var one = new(big.Int).SetInt64(1)
|
||||
// curve using the procedure given in [NSA] A.2.1.
|
||||
func randFieldElement(c *elliptic.Curve, rand io.Reader) (k *big.Int, err os.Error) {
|
||||
b := make([]byte, c.BitSize/8+8)
|
||||
_, err = rand.Read(b)
|
||||
_, err = io.ReadFull(rand, b)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ func nonZeroRandomBytes(s []byte, rand io.Reader) (err os.Error) {
|
||||
|
||||
for i := 0; i < len(s); i++ {
|
||||
for s[i] == 0 {
|
||||
_, err = rand.Read(s[i : i+1])
|
||||
_, err = io.ReadFull(rand, s[i:i+1])
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user