libfreemkv: align E7021→E7017 in comments/test-names (keys-but-no-VID is AacsVidUnavailable)

This commit is contained in:
Matthew Jackson
2026-06-25 07:59:54 -07:00
parent 3c42950ecd
commit 62d2dfe96a
2 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -1144,7 +1144,7 @@ pub enum ResolveFailure {
/// Identical key derivation to the [`resolve_keys_v1`] / [`resolve_keys_v2`] / /// Identical key derivation to the [`resolve_keys_v1`] / [`resolve_keys_v2`] /
/// [`resolve_keys_v21`] chain (it calls straight through to them); the only /// [`resolve_keys_v21`] chain (it calls straight through to them); the only
/// addition is that an unresolved disc returns a typed [`ResolveFailure`] /// addition is that an unresolved disc returns a typed [`ResolveFailure`]
/// instead of a bare `None`, so callers can report E7021 (material but no VID) /// instead of a bare `None`, so callers can report E7017 (material but no VID)
/// vs E7022 (no material). `version_u8` is the on-disc AACS major (1 → V10, /// vs E7022 (no material). `version_u8` is the on-disc AACS major (1 → V10,
/// anything else → the V20/V21 chain), matching `AacsState::version`. /// anything else → the V20/V21 chain), matching `AacsState::version`.
pub fn resolve_keys_with_reason( pub fn resolve_keys_with_reason(
@@ -3172,7 +3172,7 @@ mod tests {
// ── resolve_keys_with_reason / classify_resolve_failure ──────────────── // ── resolve_keys_with_reason / classify_resolve_failure ────────────────
// //
// The rc.6 E7021/E7022 split is also exercised end-to-end through the // The rc.6 E7017/E7022 split is also exercised end-to-end through the
// `ensure_decryptable` gate in `disc/mod.rs`. These tests pin the // `ensure_decryptable` gate in `disc/mod.rs`. These tests pin the
// *classifier* directly at the keys.rs seam and cover the branches the // *classifier* directly at the keys.rs seam and cover the branches the
// gate test does not: VID-present (must never be VidUnavailable), the // gate test does not: VID-present (must never be VidUnavailable), the
@@ -3203,7 +3203,7 @@ mod tests {
} }
/// Zero VID + PROCESSING keys (not device keys) is still "derivation /// Zero VID + PROCESSING keys (not device keys) is still "derivation
/// material present, VID missing" → VidUnavailable (E7021). The gate test /// material present, VID missing" → VidUnavailable (E7017). The gate test
/// only proves the device-keys arm of `has_derivation_material`; this pins /// only proves the device-keys arm of `has_derivation_material`; this pins
/// the processing-keys arm of the same `||`. /// the processing-keys arm of the same `||`.
#[test] #[test]
+11 -11
View File
@@ -2048,7 +2048,7 @@ impl Disc {
let needs_key = matches!(keys, crate::decrypt::DecryptKeys::None); let needs_key = matches!(keys, crate::decrypt::DecryptKeys::None);
if needs_key { if needs_key {
if self.aacs.is_some() { if self.aacs.is_some() {
// E7021 vs E7022 split: when key resolution had derivation // E7017 vs E7022 split: when key resolution had derivation
// material (device / processing keys) but no Volume ID to derive // material (device / processing keys) but no Volume ID to derive
// the unit key, the captured `aacs_error` is `AacsVidUnavailable` // the unit key, the captured `aacs_error` is `AacsVidUnavailable`
// — report THAT (the fix is recovering the VID, not adding keys), // — report THAT (the fix is recovering the VID, not adding keys),
@@ -2278,7 +2278,7 @@ impl Disc {
// stride; V20/V21 share the 64-byte stride, so try the classical V20 // stride; V20/V21 share the 64-byte stride, so try the classical V20
// paths first and fall back to the 2.1 variant chain. The // paths first and fall back to the 2.1 variant chain. The
// reason-preserving wrapper threads the no-key cause out so the // reason-preserving wrapper threads the no-key cause out so the
// decrypt gate can report E7021 (had derivation material but no VID) // decrypt gate can report E7017 (had derivation material but no VID)
// vs E7022 (no usable material) instead of a flat AacsKeyRejected. // vs E7022 (no usable material) instead of a flat AacsKeyRejected.
let resolved = crate::aacs::resolve_keys_with_reason(&ctx, version_u8) let resolved = crate::aacs::resolve_keys_with_reason(&ctx, version_u8)
.map_err(|_reason| crate::error::Error::AacsKeyRejected)?; .map_err(|_reason| crate::error::Error::AacsKeyRejected)?;
@@ -4003,15 +4003,15 @@ mod tests {
); );
} }
/// E7021 vs E7022 split (rc.6 WS1). When key resolution HAD derivation /// E7017 vs E7022 split (rc.6 WS1). When key resolution HAD derivation
/// material (device / processing keys) but no Volume ID was available to /// material (device / processing keys) but no Volume ID was available to
/// derive the unit key, the captured `aacs_error` is `AacsVidUnavailable` /// derive the unit key, the captured `aacs_error` is `AacsVidUnavailable`
/// — the gate must surface THAT (E7021), not the generic `NoDiscKey` /// — the gate must surface THAT (E7017), not the generic `NoDiscKey`
/// (E7022). When there was no usable key material at all, the reason is /// (E7022). When there was no usable key material at all, the reason is
/// absent and the gate keeps `NoDiscKey` (E7022). Both branches proven here. /// absent and the gate keeps `NoDiscKey` (E7022). Both branches proven here.
#[test] #[test]
fn ensure_decryptable_aacs_vid_unavailable_vs_no_key() { fn ensure_decryptable_aacs_vid_unavailable_vs_no_key() {
// Branch 1 — derivation material present, but no VID: E7021. // Branch 1 — derivation material present, but no VID: E7017.
// The resolver classifies a device-keys-but-zero-VID context as // The resolver classifies a device-keys-but-zero-VID context as
// `VidUnavailable`; that reason rides on `aacs_error`. // `VidUnavailable`; that reason rides on `aacs_error`.
let supplied = crate::aacs::provider::SuppliedKey { let supplied = crate::aacs::provider::SuppliedKey {
@@ -4045,17 +4045,17 @@ mod tests {
"device keys + zero VID must classify as VidUnavailable" "device keys + zero VID must classify as VidUnavailable"
); );
let mut disc_e7021 = make_test_disc(1000, "UHD"); let mut disc_e7017 = make_test_disc(1000, "UHD");
disc_e7021.encrypted = true; disc_e7017.encrypted = true;
disc_e7021.aacs = Some(aacs_with(Vec::new())); // present but no unit keys disc_e7017.aacs = Some(aacs_with(Vec::new())); // present but no unit keys
disc_e7021.aacs_error = Some(crate::error::Error::AacsVidUnavailable); disc_e7017.aacs_error = Some(crate::error::Error::AacsVidUnavailable);
let err = disc_e7021 let err = disc_e7017
.ensure_decryptable(false) .ensure_decryptable(false)
.expect_err("AACS disc, material-but-no-VID, !raw must error"); .expect_err("AACS disc, material-but-no-VID, !raw must error");
assert_eq!( assert_eq!(
err.code(), err.code(),
crate::error::Error::AacsVidUnavailable.code(), crate::error::Error::AacsVidUnavailable.code(),
"material-but-no-VID must surface E7021 (AacsVidUnavailable), not E7022" "material-but-no-VID must surface E7017 (AacsVidUnavailable), not E7022"
); );
// Branch 2 — no key material at all: classified NoMaterial, gate E7022. // Branch 2 — no key material at all: classified NoMaterial, gate E7022.