mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
e14339d34c
commit
123b38e105
2 changed files with 2 additions and 2 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue