keydb: public-crate hygiene — scrub internal tool name from comments, synthetic test disc hash

This commit is contained in:
Matthew Jackson
2026-06-28 16:49:16 -07:00
parent e2880dd8f8
commit 334ef968c7
2 changed files with 8 additions and 10 deletions
+4 -7
View File
@@ -167,8 +167,8 @@ impl KeydbSource {
};
// UNION every source of terminal keys, then dedup — never first-hit. A
// stored `unit_keys` list can be PARTIAL (the keyupdater only ever sampled
// the CPS units reachable from a playlist, so an orphan unit's key may be
// stored `unit_keys` list can be PARTIAL (the key-import tool only ever
// sampled the CPS units reachable from a playlist, so an orphan unit's key may be
// missing), while the per-disc VUK boils EVERY declared CPS unit. Taking
// the stored list alone (the old return-at-first-path) would shadow the
// VUK and silently drop the orphan unit's key. So gather both and keep a
@@ -460,7 +460,7 @@ mod tests {
}
/// Orphan-unit completeness (the real keydb bug): an entry stores only `uk1`
/// (the keyupdater sampled one reachable CPS unit) but ALSO carries the VUK,
/// (the key-import tool sampled one reachable CPS unit) but ALSO carries the VUK,
/// which boils BOTH declared units. The old return-at-first-path handed back
/// just `[uk1]`, shadowing the VUK and silently dropping the orphan unit. The
/// union must return BOTH — the stored uk1 AND the VUK-derived second unit.
@@ -477,10 +477,7 @@ mod tests {
let got = KeydbSource::unit_keys_from(&db, &ctx(HASH, enc.clone(), None));
let got_keys: Vec<[u8; 16]> = got.iter().map(|u| u.key).collect();
assert!(
got_keys.contains(&[0xA0u8; 16]),
"the stored uk1 is kept"
);
assert!(got_keys.contains(&[0xA0u8; 16]), "the stored uk1 is kept");
assert!(
got_keys.contains(&derived[1].key),
"the VUK-derived SECOND CPS unit is added, not shadowed by the partial stored list"
+4 -3
View File
@@ -391,8 +391,8 @@ impl KeyDb {
/// keydb wire format lives in ONE place (parse + emit together). Emits, in a
/// deterministic order: host certs, device keys, processing keys, then one
/// line per disc entry (sorted by hash). `parse(to_keydb_cfg(kd))` reproduces
/// every field (see `round_trips_through_parse`). Used by the keyupdater to
/// export a complete keydb.cfg (keys + host certs + VIDs).
/// every field (see `round_trips_through_parse`). Used by the key-import tool
/// to export a complete keydb.cfg (keys + host certs + VIDs).
///
/// The trailing `; <comment>` (MKB version / volume size / UHD) is emitted
/// ONLY after a `U` (unit-keys) field — that is the one place the parser
@@ -750,7 +750,8 @@ mod tests {
"| HC | HOST_PRIV_KEY 0x{priv20} | HOST_CERT 0x{cert} ; Revoked in MKBv72\n\
| DK | DEVICE_KEY 0x{k16} | DEVICE_NODE 0x0a00 | KEY_UV 0x00000e23 | KEY_U_MASK_SHIFT 0x0b\n\
| PK | 0x{pk16}\n\
0x422eb284b8d755e2a96a2781e95998caad0b1290 = Dunkirk | M | 0x{mk16} | I | 0x{id16} | V | 0x{vuk16} | U | 1-0x{u1} 2-0x{u2} ; MKBv76 VolumeSize: 81309007872 (UHD)\n",
0x{hash20} = TestDisc | M | 0x{mk16} | I | 0x{id16} | V | 0x{vuk16} | U | 1-0x{u1} 2-0x{u2} ; MKBv76 VolumeSize: 81309007872 (UHD)\n",
hash20 = h(0xab, 20),
priv20 = h(0x88, 20),
cert = cert,
k16 = h(0x66, 16),