aacs: source OEM host certs from keysource layer

Complete the OEM/AACS cert baseline so host certs are a KeySource output,
never compiled in. With an unlocker present the OEM route is unused
(unlocker_read_volume_id short-circuits); without one, the cert handshake
runs when a keysource supplies a host cert and fails gracefully when none
does.

- KeySource trait gains host_certs() (default empty), reusing the existing
  aacs::HostCert type. A source holds certs as its second kind of AACS
  material alongside decryption keys.
- ScanOptions gains key_sources so the handshake can collect certs across
  the app's keysource layer, unioned with DriveCredentials.
- do_handshake_cert collects certs via collect_host_certs (credentials +
  every key source). Zero certs from any source now returns the new
  graceful Error::AacsNoHostCert (code 7024, sentinel <no host cert>)
  instead of silently skipping; resolution still falls back to the
  path-1 disc-hash -> VUK lookup, which drops the error on a hit.
- error.rs: add E_AACS_NO_HOST_CERT / Error::AacsNoHostCert, wired into
  code(), Display, and the round-trip + sentinel tests.

HandshakeResult { volume_id, read_data_key } unchanged: the cert path
still yields both the VID and the bus key.
This commit is contained in:
Matthew Jackson
2026-06-22 11:23:38 -07:00
parent 25acd09504
commit 4f606ae9a3
4 changed files with 183 additions and 15 deletions
+15
View File
@@ -1135,7 +1135,22 @@ pub struct DriveCredentials {
pub struct ScanOptions {
/// Host credentials for the live-drive AACS handshake. `None` for ISO
/// scans, or a live drive where cert auth should be skipped.
///
/// Host certs may ALSO be supplied through [`Self::key_sources`]: the
/// handshake unifies certs from both, so the app can pass its already-built
/// keysource layer rather than (or in addition to) pre-extracting certs into
/// `DriveCredentials`. Either route is keysource-served — certs are never
/// compiled into the library.
pub credentials: Option<DriveCredentials>,
/// The application's key-source layer. The handshake collects host certs
/// across these (via [`crate::KeySource::host_certs`]) for the OEM/AACS
/// cert-auth route, unioned with [`Self::credentials`]. Empty by default —
/// an ISO scan supplies none, and a live-drive caller that pre-extracted
/// certs into `credentials` may leave it empty too. The library still
/// resolves NO keys from these at scan time; they are consulted only for
/// their host certs here (key *resolution* stays out-of-band via
/// `Disc::decrypt_with`).
pub key_sources: Vec<Box<dyn crate::KeySource>>,
/// Optional cooperative-cancellation token. When set, long scan-time
/// loops (notably the CSS known-plaintext crack, which can scan up to
/// 50_000 sectors on a live DVD) poll it and bail out cleanly so a