From a7745ad931a412cccdbfe3ffed1fd9f0cc4521e8 Mon Sep 17 00:00:00 2001 From: Matthew Jackson <1085847+MattJackson@users.noreply.github.com> Date: Mon, 29 Jun 2026 16:49:52 -0700 Subject: [PATCH] unlock: firmware unlocker matches only the drive-prep phase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- ld/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ld/src/lib.rs b/ld/src/lib.rs index 71b369a..d024c27 100644 --- a/ld/src/lib.rs +++ b/ld/src/lib.rs @@ -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