From 46838c63ca927ecad9a47255994575727fa574b4 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Thu, 4 Jun 2026 15:32:12 -0700 Subject: [PATCH] AACS: trim the MKB captured at keyless scan to its record length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The VID-only scan path stashed MKB_RO/RW raw — those files are allocated to a fixed ~128 MiB and zero-padded, so the MKB on AacsState (consumed by Disc::inputs() and the device/processing-key decrypt_with derivation) was the full pad, not the ~few-MB record stream. Trim to mkb_content_len, matching read_aacs_inputs. --- src/disc/encrypt.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/disc/encrypt.rs b/src/disc/encrypt.rs index 1d43297..67cb15d 100644 --- a/src/disc/encrypt.rs +++ b/src/disc/encrypt.rs @@ -570,12 +570,21 @@ impl Disc { None if bus_encryption => 2, None => 1, }; - // MKB_RO is the correctly-sized copy; avoid reading the padded RW region. - let mkb_bytes = udf_fs + // MKB_RO/RW are allocated to a fixed ~128 MiB and zero-padded; trim to + // the real record length (same as `read_aacs_inputs`). Without this the + // MKB stashed on `AacsState` — which `Disc::inputs()` and the device/ + // processing-key `decrypt_with` derivation consume, and which a key + // source ships to an online service — is the full 128 MiB pad, not the + // ~few-MB record stream. + let mut mkb_bytes = udf_fs .read_file(reader, "/AACS/MKB_RO.inf") .or_else(|_| udf_fs.read_file(reader, "/AACS/MKB_RW.inf")) .ok() .unwrap_or_default(); + let n = aacs::mkb_content_len(&mkb_bytes); + if n > 0 && n < mkb_bytes.len() { + mkb_bytes.truncate(n); + } let mkb_ver = aacs::mkb_version(&mkb_bytes); tracing::warn!(