diff --git a/src/crypto/ecdsa/ecdsa.go b/src/crypto/ecdsa/ecdsa.go index 59902014df..d003f9d0b3 100644 --- a/src/crypto/ecdsa/ecdsa.go +++ b/src/crypto/ecdsa/ecdsa.go @@ -140,7 +140,7 @@ func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err err entropylen = 32 } entropy := make([]byte, entropylen) - _, err = rand.Read(entropy) + _, err = io.ReadFull(rand, entropy) if err != nil { return } 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 {