mirror of
https://github.com/octoleo/restic.git
synced 2024-11-02 19:49:44 +00:00
Use the same buffer for decryption
This commit is contained in:
parent
710499cf46
commit
e571b6a656
@ -64,15 +64,13 @@ func (r *Repository) LoadAndDecrypt(t restic.FileType, id restic.ID) ([]byte, er
|
|||||||
return nil, errors.New("invalid data returned")
|
return nil, errors.New("invalid data returned")
|
||||||
}
|
}
|
||||||
|
|
||||||
plain := make([]byte, len(buf))
|
|
||||||
|
|
||||||
// decrypt
|
// decrypt
|
||||||
n, err := r.decryptTo(plain, buf)
|
n, err := r.decryptTo(buf, buf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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
|
// loadBlob tries to load and decrypt content identified by t and id from a
|
||||||
|
Loading…
Reference in New Issue
Block a user