decrypt_sectors returns Result — fail instead of silent corruption

Previously used all-zeros AES key when unit_key_idx was out of range,
producing silently corrupted output. Now returns DecryptFailed error.
Also wired --raw flag through InputOptions → set_raw() on streams.
This commit is contained in:
MattJackson
2026-04-15 01:52:36 +00:00
parent 119d09ed02
commit 6824f430d8
4 changed files with 557 additions and 134 deletions
+2 -1
View File
@@ -205,7 +205,8 @@ impl IsoStream {
// Decrypt after read — stream handles its own decryption
let bytes = count as usize * SECTOR_SIZE as usize;
decrypt_sectors(&mut self.batch_buf[..bytes], &self.decrypt_keys, 0);
decrypt_sectors(&mut self.batch_buf[..bytes], &self.decrypt_keys, 0)
.map_err(|e| io::Error::other(e.to_string()))?;
self.buf_pos = 0;
self.buf_len = bytes;