From c81cc5ccaabaee0162ef407f5c7861de5d9ed0e7 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Wed, 15 Jul 2026 19:35:25 -0700 Subject: [PATCH] Adapt keydb test to segregated decrypt primitives; 1.4.2 changelog The KEYDB-gated test that feeds real key material into libfreemkv's AACS crypto now composes decrypt_unit + is_clean (the removed decrypt_unit_try_keys wrapper's behaviour), unchanged semantics. --- CHANGELOG.md | 6 ++++++ src/keydb_format.rs | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bdfb4e..348572b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [1.4.2] — 2026-07-15 + +Version sync with the workspace; inherits libfreemkv 1.4.2. The keydb test that +feeds real key material into the AACS crypto was adapted to the segregated +`decrypt_unit` + `is_clean` primitives (behaviour unchanged). + ## [1.4.1] — 2026-07-14 Version sync with the workspace; inherits libfreemkv 1.4.1. diff --git a/src/keydb_format.rs b/src/keydb_format.rs index bbb2da0..709187d 100644 --- a/src/keydb_format.rs +++ b/src/keydb_format.rs @@ -1412,7 +1412,7 @@ mod tests { // // These exercise the parser (KeyDb::load) end-to-end against a real // keydb.cfg and feed its material into libfreemkv's AACS crypto - // (derive_vuk / decrypt_unit_try_keys). They live here now that the + // (derive_vuk, then decrypt_unit + is_clean_ts). They live here now that the // parser lives here. All are KEYDB_PATH-env-gated and no-op in CI when // the env is unset; they must still COMPILE. // ════════════════════════════════════════════════════════════════════ @@ -1485,20 +1485,20 @@ mod tests { eprintln!("Found {} entries with unit keys", candidate_entries.len()); - // Try each entry's unit keys + // Try each entry's unit keys: apply the key, then ask whether it opened + // the unit (the segregated primitives — decrypt, then structural check). for entry in &candidate_entries { - let keys: Vec<[u8; 16]> = entry.unit_keys.iter().map(|(_, k)| *k).collect(); - let mut unit = original.clone(); - - if let Some(res) = libfreemkv::aacs::content::decrypt_unit_try_keys(&mut unit, &keys) { - eprintln!( - "SUCCESS: Decrypted with entry {} ({res:?})", - entry.disc_hash - ); - // Count TS sync bytes - let ts = (0..32).filter(|&i| unit[4 + i * 192] == 0x47).count(); - eprintln!(" TS sync bytes: {}/32", ts); - return; + for (_, key) in &entry.unit_keys { + let mut unit = original.clone(); + libfreemkv::aacs::content::decrypt_unit(&mut unit, key); + if libfreemkv::aacs::content::is_clean(&unit, libfreemkv::disc::ContentFormat::BdTs) + { + eprintln!("SUCCESS: Decrypted with entry {}", entry.disc_hash); + // Count TS sync bytes + let ts = (0..32).filter(|&i| unit[4 + i * 192] == 0x47).count(); + eprintln!(" TS sync bytes: {}/32", ts); + return; + } } }