1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:04:40 -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:
Dmitry Chestnykh 2011-04-05 17:11:31 -04:00 committed by Adam Langley
parent db99a784c2
commit 9f1394d270
2 changed files with 2 additions and 2 deletions

View File

@ -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
}

View File

@ -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
}