summaryrefslogtreecommitdiff
path: root/src/pkg/crypto/rand/rand.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/crypto/rand/rand.go')
-rw-r--r--src/pkg/crypto/rand/rand.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pkg/crypto/rand/rand.go b/src/pkg/crypto/rand/rand.go
index 59759038e..4da3adb70 100644
--- a/src/pkg/crypto/rand/rand.go
+++ b/src/pkg/crypto/rand/rand.go
@@ -14,5 +14,8 @@ import "io"
// On Windows systems, Reader uses the CryptGenRandom API.
var Reader io.Reader
-// Read is a helper function that calls Reader.Read.
-func Read(b []byte) (n int, err error) { return Reader.Read(b) }
+// Read is a helper function that calls Reader.Read using io.ReadFull.
+// On return, n == len(b) if and only if err == nil.
+func Read(b []byte) (n int, err error) {
+ return io.ReadFull(Reader, b)
+}