unlock: firmware unlocker matches only the drive-prep phase

LibreDrive::matches now requires ctx.kind == DiscKind::Unknown (the drive-prep
dispatch) in addition to a bundled-profile hit. This keeps the firmware unlock
from firing during the later content-keyed (Aacs/Css) dispatch on a profiled
drive — the registry is walked at one spot per phase and matches() is the only
filter.
This commit is contained in:
Matthew Jackson
2026-06-29 16:49:52 -07:00
parent a79dd55b3f
commit a7745ad931
+6 -3
View File
@@ -27,7 +27,7 @@ mod platform;
use error::Result;
use libfreemkv::aacs::Vid;
use libfreemkv::{DriveId, ScsiTransport, UnlockCtx, UnlockError, Unlocked, Unlocker};
use libfreemkv::{DiscKind, DriveId, ScsiTransport, UnlockCtx, UnlockError, Unlocked, Unlocker};
use scsi::DataDirection;
/// The LibreDrive unlocker.
@@ -129,8 +129,11 @@ impl Unlocker for LibreDrive {
}
fn matches(&self, ctx: &UnlockCtx) -> bool {
// Firmware unlock keys off the drive identity; disc kind is irrelevant.
profile::find_bundled(ctx.drive_id).is_some()
// Firmware unlock is a drive-prep concern: it runs before the disc kind
// is probed (ctx.kind == Unknown) and keys off the drive identity. It
// must NOT fire during the later content-keyed dispatch (kind Aacs/Css),
// or a DVD/Blu-ray in a profiled drive would be re-firmware-unlocked.
ctx.kind == DiscKind::Unknown && profile::find_bundled(ctx.drive_id).is_some()
}
/// Firmware-unlock the drive AND return the disc's OEM Volume ID in one step