Fix audit v2 criticals: DiscStream read loop, CSS crack, ISO writer
Critical fixes: - DiscStream: persistent read state (was creating new ContentReader per call) Full error recovery, AACS/CSS decryption, extent tracking across reads - CSS crack: labeled 'outer continue (was targeting wrong loop) - CSS crack: LFSR0 polynomial fixed to match cipher (shifts 8,1,3,7) - CSS lfsr: operator precedence clarified in LFSR0 init Warning fixes: - ISO writer: UDF tag checksums computed (was zeros) - DVD extents: saturating_add for overflow safety - Removed dead fields: HandshakeResult.error, ContentReader.content_format - Added TODO for ISO long_ad >4GB support 319 tests, 20 clippy warnings remaining.
This commit is contained in:
+2
-2
@@ -98,7 +98,7 @@ pub fn recover_title_key(sector: &[u8], plain: &[u8]) -> Option<[u8; 5]> {
|
|||||||
let t4_perm = TAB5[t4 as usize];
|
let t4_perm = TAB5[t4 as usize];
|
||||||
|
|
||||||
// Clock LFSR0 forward
|
// Clock LFSR0 forward
|
||||||
let t6 = (((((((t3 >> 8) ^ t3) >> 1) ^ t3) >> 3) ^ t3) >> 7);
|
let t6 = ((((((t3 >> 8) ^ t3) >> 1) ^ t3) >> 3) ^ t3) >> 7;
|
||||||
t3 = (t3 << 8) | (t6 & 0xFF);
|
t3 = (t3 << 8) | (t6 & 0xFF);
|
||||||
let t6_perm = TAB4[(t6 & 0xFF) as usize];
|
let t6_perm = TAB4[(t6 & 0xFF) as usize];
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ pub fn recover_title_key(sector: &[u8], plain: &[u8]) -> Option<[u8; 5]> {
|
|||||||
let mut found_j = false;
|
let mut found_j = false;
|
||||||
for j in 0u32..256 {
|
for j in 0u32..256 {
|
||||||
t3 = (t3 & 0x1FFFF) | (j << 17);
|
t3 = (t3 & 0x1FFFF) | (j << 17);
|
||||||
let t6 = (((((((t3 >> 8) ^ t3) >> 1) ^ t3) >> 3) ^ t3) >> 7);
|
let t6 = ((((((t3 >> 8) ^ t3) >> 1) ^ t3) >> 3) ^ t3) >> 7;
|
||||||
if (t6 & 0xFF) == t1_byte {
|
if (t6 & 0xFF) == t1_byte {
|
||||||
found_j = true;
|
found_j = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
+3
-3
@@ -10,7 +10,7 @@
|
|||||||
use super::IOStream;
|
use super::IOStream;
|
||||||
use crate::disc::{
|
use crate::disc::{
|
||||||
ContentFormat, Disc, DiscTitle, Extent,
|
ContentFormat, Disc, DiscTitle, Extent,
|
||||||
DEFAULT_BATCH_SECTORS, MIN_BATCH_SECTORS, RAMP_BATCH_AFTER, RAMP_SPEED_AFTER,
|
MIN_BATCH_SECTORS, RAMP_BATCH_AFTER, RAMP_SPEED_AFTER,
|
||||||
SLOW_SPEED_AFTER, detect_max_batch_sectors,
|
SLOW_SPEED_AFTER, detect_max_batch_sectors,
|
||||||
};
|
};
|
||||||
use crate::drive::DriveSession;
|
use crate::drive::DriveSession;
|
||||||
@@ -54,6 +54,7 @@ pub struct DiscStream {
|
|||||||
extents: Vec<Extent>,
|
extents: Vec<Extent>,
|
||||||
current_extent: usize,
|
current_extent: usize,
|
||||||
current_offset: u32,
|
current_offset: u32,
|
||||||
|
#[allow(dead_code)]
|
||||||
content_format: ContentFormat,
|
content_format: ContentFormat,
|
||||||
aacs: Option<AacsDecrypt>,
|
aacs: Option<AacsDecrypt>,
|
||||||
css: Option<crate::css::CssState>,
|
css: Option<crate::css::CssState>,
|
||||||
@@ -349,8 +350,7 @@ impl Write for DiscStream {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use crate::disc::Extent;
|
||||||
use crate::disc::{ContentFormat, DiscTitle, Extent};
|
|
||||||
|
|
||||||
/// Build a minimal DiscStream with fake extents for testing state advancement.
|
/// Build a minimal DiscStream with fake extents for testing state advancement.
|
||||||
/// We cannot call `DiscStream::open()` without a real drive, so we construct
|
/// We cannot call `DiscStream::open()` without a real drive, so we construct
|
||||||
|
|||||||
Reference in New Issue
Block a user