0.27.5 (step 2, item 2): rename provenance enum KeySource -> KeyOrigin
Disambiguates the key vocabulary: Key (the input handed to decrypt_with), key sources (the resolver's lookup list), and KeyOrigin (how a key was resolved). Internal-only rename — no dependents import it.
This commit is contained in:
+8
-8
@@ -454,12 +454,12 @@ impl Disc {
|
|||||||
mkb_version: mkb_ver,
|
mkb_version: mkb_ver,
|
||||||
disc_hash: aacs::disc_hash_hex(&resolved.disc_hash),
|
disc_hash: aacs::disc_hash_hex(&resolved.disc_hash),
|
||||||
key_source: match resolved.key_source {
|
key_source: match resolved.key_source {
|
||||||
1 => KeySource::DeviceKey,
|
1 => KeyOrigin::DeviceKey,
|
||||||
2 => KeySource::ProcessingKey,
|
2 => KeyOrigin::ProcessingKey,
|
||||||
3 => KeySource::KeyDbDerived,
|
3 => KeyOrigin::KeyDbDerived,
|
||||||
4 => KeySource::KeyDb,
|
4 => KeyOrigin::KeyDb,
|
||||||
5 => KeySource::KeyDbUnitKeys,
|
5 => KeyOrigin::KeyDbUnitKeys,
|
||||||
_ => KeySource::KeyDb,
|
_ => KeyOrigin::KeyDb,
|
||||||
},
|
},
|
||||||
vuk: resolved.vuk,
|
vuk: resolved.vuk,
|
||||||
unit_keys: resolved.unit_keys,
|
unit_keys: resolved.unit_keys,
|
||||||
@@ -522,7 +522,7 @@ impl Disc {
|
|||||||
bus_encryption,
|
bus_encryption,
|
||||||
mkb_version: mkb_ver,
|
mkb_version: mkb_ver,
|
||||||
disc_hash: aacs::disc_hash_hex(&dh),
|
disc_hash: aacs::disc_hash_hex(&dh),
|
||||||
key_source: KeySource::ExternalUk,
|
key_source: KeyOrigin::ExternalUk,
|
||||||
vuk: None,
|
vuk: None,
|
||||||
unit_keys: vec![(1, unit_key)],
|
unit_keys: vec![(1, unit_key)],
|
||||||
read_data_key: handshake.and_then(|h| h.read_data_key),
|
read_data_key: handshake.and_then(|h| h.read_data_key),
|
||||||
@@ -585,7 +585,7 @@ impl Disc {
|
|||||||
bus_encryption,
|
bus_encryption,
|
||||||
mkb_version: mkb_ver,
|
mkb_version: mkb_ver,
|
||||||
disc_hash: aacs::disc_hash_hex(&dh),
|
disc_hash: aacs::disc_hash_hex(&dh),
|
||||||
key_source: KeySource::ExternalUk,
|
key_source: KeyOrigin::ExternalUk,
|
||||||
vuk: None,
|
vuk: None,
|
||||||
unit_keys: vec![],
|
unit_keys: vec![],
|
||||||
read_data_key: handshake.and_then(|h| h.read_data_key),
|
read_data_key: handshake.and_then(|h| h.read_data_key),
|
||||||
|
|||||||
+15
-15
@@ -882,9 +882,9 @@ pub struct AacsState {
|
|||||||
/// Disc hash (SHA1 of Unit_Key_RO.inf) -- hex string with 0x prefix
|
/// Disc hash (SHA1 of Unit_Key_RO.inf) -- hex string with 0x prefix
|
||||||
pub disc_hash: String,
|
pub disc_hash: String,
|
||||||
/// How keys were resolved
|
/// How keys were resolved
|
||||||
pub key_source: KeySource,
|
pub key_source: KeyOrigin,
|
||||||
/// Volume Unique Key (16 bytes). `None` when keys were resolved
|
/// Volume Unique Key (16 bytes). `None` when keys were resolved
|
||||||
/// via the [`KeySource::KeyDbUnitKeys`] path — that source delivers
|
/// via the [`KeyOrigin::KeyDbUnitKeys`] path — that source delivers
|
||||||
/// pre-decrypted unit keys without a VUK to derive them from.
|
/// pre-decrypted unit keys without a VUK to derive them from.
|
||||||
pub vuk: Option<[u8; 16]>,
|
pub vuk: Option<[u8; 16]>,
|
||||||
/// Decrypted unit keys (CPS unit number, key)
|
/// Decrypted unit keys (CPS unit number, key)
|
||||||
@@ -900,7 +900,7 @@ pub struct AacsState {
|
|||||||
/// attempts derivation from the strongest input it has first and falls
|
/// attempts derivation from the strongest input it has first and falls
|
||||||
/// back toward pre-computed per-disc material.
|
/// back toward pre-computed per-disc material.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub enum KeySource {
|
pub enum KeyOrigin {
|
||||||
/// MKB + device keys → subset-difference tree → VUK
|
/// MKB + device keys → subset-difference tree → VUK
|
||||||
DeviceKey,
|
DeviceKey,
|
||||||
/// MKB + processing keys → media key → VUK
|
/// MKB + processing keys → media key → VUK
|
||||||
@@ -917,15 +917,15 @@ pub enum KeySource {
|
|||||||
ExternalUk,
|
ExternalUk,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl KeySource {
|
impl KeyOrigin {
|
||||||
pub fn name(&self) -> &'static str {
|
pub fn name(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
KeySource::DeviceKey => "MKB + device key",
|
KeyOrigin::DeviceKey => "MKB + device key",
|
||||||
KeySource::ProcessingKey => "MKB + processing key",
|
KeyOrigin::ProcessingKey => "MKB + processing key",
|
||||||
KeySource::KeyDbDerived => "KEYDB (derived)",
|
KeyOrigin::KeyDbDerived => "KEYDB (derived)",
|
||||||
KeySource::KeyDb => "KEYDB",
|
KeyOrigin::KeyDb => "KEYDB",
|
||||||
KeySource::KeyDbUnitKeys => "KEYDB (unit keys)",
|
KeyOrigin::KeyDbUnitKeys => "KEYDB (unit keys)",
|
||||||
KeySource::ExternalUk => "external UK",
|
KeyOrigin::ExternalUk => "external UK",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1543,14 +1543,14 @@ impl Disc {
|
|||||||
pub fn inject_unit_keys(&mut self, keys: Vec<(u32, [u8; 16])>) {
|
pub fn inject_unit_keys(&mut self, keys: Vec<(u32, [u8; 16])>) {
|
||||||
if let Some(aacs) = self.aacs.as_mut() {
|
if let Some(aacs) = self.aacs.as_mut() {
|
||||||
aacs.unit_keys = keys;
|
aacs.unit_keys = keys;
|
||||||
aacs.key_source = KeySource::ExternalUk;
|
aacs.key_source = KeyOrigin::ExternalUk;
|
||||||
} else if self.encrypted && self.css.is_none() {
|
} else if self.encrypted && self.css.is_none() {
|
||||||
self.aacs = Some(AacsState {
|
self.aacs = Some(AacsState {
|
||||||
version: if self.format == DiscFormat::Uhd { 2 } else { 1 },
|
version: if self.format == DiscFormat::Uhd { 2 } else { 1 },
|
||||||
bus_encryption: self.format == DiscFormat::Uhd,
|
bus_encryption: self.format == DiscFormat::Uhd,
|
||||||
mkb_version: None,
|
mkb_version: None,
|
||||||
disc_hash: String::new(),
|
disc_hash: String::new(),
|
||||||
key_source: KeySource::ExternalUk,
|
key_source: KeyOrigin::ExternalUk,
|
||||||
vuk: None,
|
vuk: None,
|
||||||
unit_keys: keys,
|
unit_keys: keys,
|
||||||
read_data_key: None,
|
read_data_key: None,
|
||||||
@@ -2816,7 +2816,7 @@ mod tests {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
disc.aacs.as_ref().unwrap().key_source,
|
disc.aacs.as_ref().unwrap().key_source,
|
||||||
KeySource::ExternalUk
|
KeyOrigin::ExternalUk
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2828,7 +2828,7 @@ mod tests {
|
|||||||
bus_encryption: true,
|
bus_encryption: true,
|
||||||
mkb_version: None,
|
mkb_version: None,
|
||||||
disc_hash: String::new(),
|
disc_hash: String::new(),
|
||||||
key_source: KeySource::DeviceKey,
|
key_source: KeyOrigin::DeviceKey,
|
||||||
vuk: None,
|
vuk: None,
|
||||||
unit_keys,
|
unit_keys,
|
||||||
read_data_key: None,
|
read_data_key: None,
|
||||||
@@ -2866,7 +2866,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
disc.aacs.as_ref().unwrap().key_source,
|
disc.aacs.as_ref().unwrap().key_source,
|
||||||
KeySource::ExternalUk
|
KeyOrigin::ExternalUk
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -170,7 +170,7 @@ pub use decrypt::{DecryptKeys, decrypt_sectors, decrypt_threads, set_decrypt_thr
|
|||||||
// prefix at the crate root to keep both addressable.
|
// prefix at the crate root to keep both addressable.
|
||||||
pub use disc::{
|
pub use disc::{
|
||||||
AacsState, AudioChannels, AudioStream, Clip, Codec, ColorSpace, ContentFormat, DamageSeverity,
|
AacsState, AudioChannels, AudioStream, Clip, Codec, ColorSpace, ContentFormat, DamageSeverity,
|
||||||
Disc, DiscFormat, DiscId, DiscTitle, Extent, FrameRate, HdrFormat, Key, KeySource,
|
Disc, DiscFormat, DiscId, DiscTitle, Extent, FrameRate, HdrFormat, Key, KeyOrigin,
|
||||||
LabelPurpose, LabelQualifier, PatchOptions, PatchOutcome, Resolution, SampleRate, ScanOptions,
|
LabelPurpose, LabelQualifier, PatchOptions, PatchOutcome, Resolution, SampleRate, ScanOptions,
|
||||||
Stream, SubtitleStream, SweepOptions, VideoStream, classify_damage,
|
Stream, SubtitleStream, SweepOptions, VideoStream, classify_damage,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user