aacs: rustfmt verify-gate files + correct cert/unit-key test fixtures to libaacs-strict layout; 1.1.0-beta.1 changelog

This commit is contained in:
Matthew Jackson
2026-06-28 16:49:16 -07:00
parent f23338b5dd
commit fb8405385e
6 changed files with 110 additions and 34 deletions
+12 -8
View File
@@ -2521,15 +2521,19 @@ mod tests {
#[test]
fn parse_unit_key_ro_title_cps_mapping_first_play_top_menu_then_titles() {
// [20..22] first_play, [22..24] top_menu, [24..26] num_titles, then
// per-title 2-byte pad + 2-byte CPS unit at 26 + i*4 + 2.
let mut data = build_unit_key_ro(2, 64);
data[20..22].copy_from_slice(&7u16.to_be_bytes()); // first_play
data[22..24].copy_from_slice(&9u16.to_be_bytes()); // top_menu
data[24..26].copy_from_slice(&2u16.to_be_bytes()); // num_titles
data[28..30].copy_from_slice(&3u16.to_be_bytes()); // title 0 CPS
data[32..34].copy_from_slice(&4u16.to_be_bytes()); // title 1 CPS
// per-title 2-byte pad + 2-byte CPS unit at 26 + i*4 + 2. Each on-disc
// 1-based CPS number in `1..=num_uk` is validated and converted to a
// 0-based key index (libaacs unit_key.c); an out-of-range number → 0.
let mut data = build_unit_key_ro(4, 64); // num_uk = 4 → CPS 1..=4 valid
data[20..22].copy_from_slice(&1u16.to_be_bytes()); // first_play CPS 1
data[22..24].copy_from_slice(&2u16.to_be_bytes()); // top_menu CPS 2
data[24..26].copy_from_slice(&3u16.to_be_bytes()); // num_titles = 3
data[28..30].copy_from_slice(&3u16.to_be_bytes()); // title 0 CPS 3
data[32..34].copy_from_slice(&4u16.to_be_bytes()); // title 1 CPS 4
data[36..38].copy_from_slice(&9u16.to_be_bytes()); // title 2 CPS 9 (> num_uk)
let p = parse_unit_key_ro(&data, AacsVersion::V20).unwrap();
assert_eq!(p.title_cps_unit, vec![7, 9, 3, 4]);
// 1-based CPS {1,2,3,4} → 0-based {0,1,2,3}; out-of-range 9 → 0.
assert_eq!(p.title_cps_unit, vec![0, 1, 2, 3, 0]);
}
// ── MKB record framing: rec_len is BE24 incl. 4-byte header ────────────
#[test]
+2 -2
View File
@@ -32,8 +32,8 @@ pub use trace::{KeyNode, KeyOutcome, KeyStep, ResolutionTrace, UnlockOutcome, Un
// AES primitives (aes_ecb_encrypt, aes_ecb_decrypt, aes_cbc_decrypt) are pub(crate) in decrypt.rs.
pub use decrypt::{
ALIGNED_UNIT_LEN, ALIGNED_UNIT_SECTORS, UnitKeyResult, aacs_unit_encrypted,
aacs_unit_needs_decrypt, decrypt_bus, decrypt_unit, decrypt_unit_full, decrypt_unit_try_keys,
decrypt_unit_checked, is_unit_aligned, ts_packet_total, ts_sync_count, ts_sync_destroyed,
aacs_unit_needs_decrypt, decrypt_bus, decrypt_unit, decrypt_unit_checked, decrypt_unit_full,
decrypt_unit_try_keys, is_unit_aligned, ts_packet_total, ts_sync_count, ts_sync_destroyed,
unit_is_clean_ps, unit_is_clean_ts, unit_key_validates,
};
// `probe` is a reproduction-harness helper (see keys.rs), not part of the