aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/rsa/rsa.go
diff options
context:
space:
mode:
authorAdam Langley <agl@golang.org>2015-03-16 16:42:12 -0700
committerAdam Langley <agl@golang.org>2015-03-18 00:37:48 +0000
commit123b38e105342ca65392ba8e20a089fe405b0791 (patch)
treede463e7f4316f298e4e441c6f5c00e66e75635bf /src/crypto/rsa/rsa.go
parente14339d34cab4ae7abd7d0f83aacff9eed516ea2 (diff)
downloadgo-123b38e105342ca65392ba8e20a089fe405b0791.tar.gz
go-123b38e105342ca65392ba8e20a089fe405b0791.zip
crypto/{ecdsa,rsa}: always use io.ReadFull with crypto/rand.Reader.
crypto/rand.Reader doesn't ensure that short reads don't happen. This change contains a couple of fixups where io.ReadFull wasn't being used with it. Change-Id: I3855b81f5890f2e703112eeea804aeba07b6a6b8 Reviewed-on: https://go-review.googlesource.com/7645 Reviewed-by: Minux Ma <minux@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org>
Diffstat (limited to 'src/crypto/rsa/rsa.go')
-rw-r--r--src/crypto/rsa/rsa.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/rsa/rsa.go b/src/crypto/rsa/rsa.go
index f9f6d25a89..99fa94e58a 100644
--- a/src/crypto/rsa/rsa.go
+++ b/src/crypto/rsa/rsa.go
@@ -102,7 +102,7 @@ func (priv *PrivateKey) Decrypt(rand io.Reader, ciphertext []byte, opts crypto.D
case *PKCS1v15DecryptOptions:
if l := opts.SessionKeyLen; l > 0 {
plaintext = make([]byte, l)
- if _, err := rand.Read(plaintext); err != nil {
+ if _, err := io.ReadFull(rand, plaintext); err != nil {
return nil, err
}
if err := DecryptPKCS1v15SessionKey(rand, priv, ciphertext, plaintext); err != nil {