2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 23:06:32 +00:00

Use the same buffer for decryption

This commit is contained in:
Alexander Neumann 2017-01-13 21:23:47 +01:00
parent 710499cf46
commit e571b6a656

View File

@ -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