sync: verify chunk size and digest, if possible

for encrypted chunks this is currently not possible, as we need the key
to decode the chunk.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2020-08-03 14:10:44 +02:00
committed by Dietmar Maurer
parent 8819d1f2f5
commit 9e496ff6f1
2 changed files with 8 additions and 6 deletions

View File

@ -35,6 +35,8 @@ impl RemoteChunkReader {
}
}
/// Downloads raw chunk. This only verifies the (untrusted) CRC32, use
/// DataBlob::verify_unencrypted or DataBlob::decode before storing/processing further.
pub async fn read_raw_chunk(&self, digest: &[u8; 32]) -> Result<DataBlob, Error> {
let mut chunk_data = Vec::with_capacity(4 * 1024 * 1024);
@ -43,8 +45,6 @@ impl RemoteChunkReader {
.await?;
let chunk = DataBlob::load_from_reader(&mut &chunk_data[..])?;
// fixme: verify digest?
Ok(chunk)
}