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:
+6
-6
@@ -29,8 +29,10 @@ impl Disc {
|
|||||||
for hc in &keydb.host_certs {
|
for hc in &keydb.host_certs {
|
||||||
match aacs::handshake::aacs_authenticate(session, &hc.private_key, &hc.certificate) {
|
match aacs::handshake::aacs_authenticate(session, &hc.private_key, &hc.certificate) {
|
||||||
Ok(mut auth) => {
|
Ok(mut auth) => {
|
||||||
let volume_id =
|
let volume_id = match aacs::handshake::read_volume_id(session, &mut auth) {
|
||||||
aacs::handshake::read_volume_id(session, &mut auth).unwrap_or([0u8; 16]);
|
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)
|
let read_data_key = aacs::handshake::read_data_keys(session, &mut auth)
|
||||||
.ok()
|
.ok()
|
||||||
.map(|(rdk, _)| rdk);
|
.map(|(rdk, _)| rdk);
|
||||||
@@ -46,10 +48,8 @@ impl Disc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
last_error.map(|_e| HandshakeResult {
|
// All host certs failed — return None, not a fake success
|
||||||
volume_id: [0u8; 16],
|
None
|
||||||
read_data_key: None,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve disc encryption — AACS 1.0, AACS 2.0, CSS, or none.
|
/// Resolve disc encryption — AACS 1.0, AACS 2.0, CSS, or none.
|
||||||
|
|||||||
Reference in New Issue
Block a user