diff options
author | Zach Hilman <zachhilman@gmail.com> | 2019-04-17 11:29:21 -0400 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2019-07-07 21:38:33 -0400 |
commit | d9ef20e5a53166fe3ecdca5ed225232eb7ad2f64 (patch) | |
tree | 25854c9201231a9b94cd884ea288f0ed84a6f790 /src/core/crypto | |
parent | f8718ae779bbdc6a3f514b5ce141515baa97e14f (diff) |
es: Populate/synthesize tickets on construction
Diffstat (limited to 'src/core/crypto')
-rw-r--r-- | src/core/crypto/key_manager.cpp | 26 | ||||
-rw-r--r-- | src/core/crypto/key_manager.h | 1 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 558790a49..3c51e3dc2 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -406,9 +406,7 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, if (issuer == std::array<u8, 0x40>{}) return {}; if (issuer[0] != 'R' || issuer[1] != 'o' || issuer[2] != 'o' || issuer[3] != 't') { - LOG_INFO(Crypto, - "Attempting to parse ticket with non-standard certificate authority {:08X}.", - issuer); + LOG_INFO(Crypto, "Attempting to parse ticket with non-standard certificate authority."); } Key128 rights_id = ticket.GetData().rights_id; @@ -481,16 +479,6 @@ KeyManager::KeyManager() { AttemptLoadKeyFile(yuzu_keys_dir, yuzu_keys_dir, "title.keys_autogenerated", true); AttemptLoadKeyFile(yuzu_keys_dir, hactool_keys_dir, "console.keys", false); AttemptLoadKeyFile(yuzu_keys_dir, yuzu_keys_dir, "console.keys_autogenerated", false); - - for (const auto& key : s128_keys) { - if (key.first.type == S128KeyType::Titlekey) { - u128 rights_id{key.first.field1, key.first.field2}; - Key128 rights_id_2; - std::memcpy(rights_id_2.data(), rights_id.data(), rights_id_2.size()); - const auto ticket = Ticket::SynthesizeCommon(key.second, rights_id_2); - common_tickets.insert_or_assign(rights_id, ticket); - } - } } static bool ValidCryptoRevisionString(std::string_view base, size_t begin, size_t length) { @@ -1011,6 +999,18 @@ void KeyManager::PopulateTickets() { } } +void KeyManager::SynthesizeTickets() { + for (const auto& key : s128_keys) { + if (key.first.type == S128KeyType::Titlekey) { + u128 rights_id{key.first.field1, key.first.field2}; + Key128 rights_id_2; + std::memcpy(rights_id_2.data(), rights_id.data(), rights_id_2.size()); + const auto ticket = Ticket::SynthesizeCommon(key.second, rights_id_2); + common_tickets.insert_or_assign(rights_id, ticket); + } + } +} + void KeyManager::SetKeyWrapped(S128KeyType id, Key128 key, u64 field1, u64 field2) { if (key == Key128{}) return; diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index ff6bd08e1..d4e89d35c 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -236,6 +236,7 @@ public: void DeriveBase(); void DeriveETicket(PartitionDataManager& data); void PopulateTickets(); + void SynthesizeTickets(); void PopulateFromPartitionData(PartitionDataManager& data); |