From 0270cf6df3965227f04c7f0040b9b48584104108 Mon Sep 17 00:00:00 2001 From: MattJackson <1085847+MattJackson@users.noreply.github.com> Date: Wed, 15 Apr 2026 01:54:58 +0000 Subject: [PATCH] Fix handshake returning fake success on failure Previously returned HandshakeResult with zeros when all host certs failed. Now returns None. Also propagates volume_id read failure instead of silently using zeros. --- src/disc/encrypt.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/disc/encrypt.rs b/src/disc/encrypt.rs index c5adb31..f1a3a92 100644 --- a/src/disc/encrypt.rs +++ b/src/disc/encrypt.rs @@ -29,8 +29,10 @@ impl Disc { for hc in &keydb.host_certs { match aacs::handshake::aacs_authenticate(session, &hc.private_key, &hc.certificate) { Ok(mut auth) => { - let volume_id = - aacs::handshake::read_volume_id(session, &mut auth).unwrap_or([0u8; 16]); + let volume_id = match aacs::handshake::read_volume_id(session, &mut auth) { + Ok(vid) => vid, + Err(_) => return None, // handshake succeeded but can't read VID + }; let read_data_key = aacs::handshake::read_data_keys(session, &mut auth) .ok() .map(|(rdk, _)| rdk); @@ -46,10 +48,8 @@ impl Disc { } } } - last_error.map(|_e| HandshakeResult { - volume_id: [0u8; 16], - read_data_key: None, - }) + // All host certs failed — return None, not a fake success + None } /// Resolve disc encryption — AACS 1.0, AACS 2.0, CSS, or none.