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.
This commit is contained in:
MattJackson
2026-04-15 01:54:58 +00:00
parent 6824f430d8
commit 0270cf6df3
+6 -6
View File
@@ -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.