mirror of
https://github.com/restic/restic.git
synced 2024-12-25 01:06:39 +00:00
Use the same buffer for decryption
This commit is contained in:
parent
710499cf46
commit
e571b6a656
1 changed files with 2 additions and 4 deletions
|
@ -64,15 +64,13 @@ func (r *Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, er
|
|||
return nil, errors.New("invalid data returned")
|
||||
}
|
||||
|
||||
plain := make([]byte, len(buf))
|
||||
|
||||
// decrypt
|
||||
n, err := r.decryptTo(plain, buf)
|
||||
n, err := r.decryptTo(buf, buf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return plain[:n], nil
|
||||
return buf[:n], nil
|
||||
}
|
||||
|
||||
// loadBlob tries to load and decrypt content identified by t and id from a
|
||||
|
|
Loading…
Reference in a new issue