mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-10 00:42:45 +01:00
key_manager: Rename KEK to Kek
This commit is contained in:
parent
89ad82ce5c
commit
721632fe66
2 changed files with 9 additions and 8 deletions
|
@ -71,23 +71,24 @@ boost::optional<Key128> DeriveSDSeed() {
|
||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, const KeyManager& keys) {
|
Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& keys) {
|
||||||
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::SDKEK)))
|
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::SDKek)))
|
||||||
return Loader::ResultStatus::ErrorMissingSDKEKSource;
|
return Loader::ResultStatus::ErrorMissingSDKEKSource;
|
||||||
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKEKGeneration)))
|
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKekGeneration)))
|
||||||
return Loader::ResultStatus::ErrorMissingAESKEKGenerationSource;
|
return Loader::ResultStatus::ErrorMissingAESKEKGenerationSource;
|
||||||
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKeyGeneration)))
|
if (!keys.HasKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKeyGeneration)))
|
||||||
return Loader::ResultStatus::ErrorMissingAESKeyGenerationSource;
|
return Loader::ResultStatus::ErrorMissingAESKeyGenerationSource;
|
||||||
|
|
||||||
const auto sd_kek_source =
|
const auto sd_kek_source =
|
||||||
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::SDKEK));
|
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::SDKek));
|
||||||
const auto aes_kek_gen =
|
const auto aes_kek_gen =
|
||||||
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKEKGeneration));
|
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKekGeneration));
|
||||||
const auto aes_key_gen =
|
const auto aes_key_gen =
|
||||||
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKeyGeneration));
|
keys.GetKey(S128KeyType::Source, static_cast<u64>(SourceKeyType::AESKeyGeneration));
|
||||||
const auto master_00 = keys.GetKey(S128KeyType::Master);
|
const auto master_00 = keys.GetKey(S128KeyType::Master);
|
||||||
const auto sd_kek =
|
const auto sd_kek =
|
||||||
GenerateKeyEncryptionKey(sd_kek_source, master_00, aes_kek_gen, aes_key_gen);
|
GenerateKeyEncryptionKey(sd_kek_source, master_00, aes_kek_gen, aes_key_gen);
|
||||||
|
keys.SetKey(S128KeyType::SDKek, sd_kek);
|
||||||
|
|
||||||
if (!keys.HasKey(S128KeyType::SDSeed))
|
if (!keys.HasKey(S128KeyType::SDSeed))
|
||||||
return Loader::ResultStatus::ErrorMissingSDSeed;
|
return Loader::ResultStatus::ErrorMissingSDSeed;
|
||||||
|
|
|
@ -50,9 +50,9 @@ enum class KeyAreaKeyType : u8 {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SourceKeyType : u8 {
|
enum class SourceKeyType : u8 {
|
||||||
SDKEK,
|
SDKek, //
|
||||||
AESKEKGeneration,
|
AESKekGeneration, //
|
||||||
AESKeyGeneration,
|
AESKeyGeneration, //
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SDKeyType : u8 {
|
enum class SDKeyType : u8 {
|
||||||
|
|
Loading…
Reference in a new issue