diff options
| author | 2018-09-23 21:03:00 -0400 | |
|---|---|---|
| committer | 2018-10-07 13:15:11 -0400 | |
| commit | a57aac5772bc4cfde06faa68c75e7d8ef546dbee (patch) | |
| tree | ad8829ed14a24865cc388b49d13005009dcafc6b /src/core/crypto/key_manager.h | |
| parent | key_manager: Add BIS key getter (diff) | |
| download | yuzu-a57aac5772bc4cfde06faa68c75e7d8ef546dbee.tar.gz yuzu-a57aac5772bc4cfde06faa68c75e7d8ef546dbee.tar.xz yuzu-a57aac5772bc4cfde06faa68c75e7d8ef546dbee.zip | |
key_manager: Add base key derivation
Derives master keys, game encryption keys, and package1/2 keys
Diffstat (limited to 'src/core/crypto/key_manager.h')
| -rw-r--r-- | src/core/crypto/key_manager.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index a729fa7a0..8de65ec4e 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h | |||
| @@ -138,9 +138,12 @@ public: | |||
| 138 | // 8*43 and the private file to exist. | 138 | // 8*43 and the private file to exist. |
| 139 | void DeriveSDSeedLazy(); | 139 | void DeriveSDSeedLazy(); |
| 140 | 140 | ||
| 141 | bool BaseDeriveNecessary(); | ||
| 142 | void DeriveBase(); | ||
| 141 | private: | 143 | private: |
| 142 | boost::container::flat_map<KeyIndex<S128KeyType>, Key128> s128_keys; | 144 | std::map<KeyIndex<S128KeyType>, Key128> s128_keys; |
| 143 | boost::container::flat_map<KeyIndex<S256KeyType>, Key256> s256_keys; | 145 | std::map<KeyIndex<S256KeyType>, Key256> s256_keys; |
| 146 | |||
| 144 | std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{}; | 147 | std::array<std::array<u8, 0xB0>, 0x20> encrypted_keyblobs{}; |
| 145 | std::array<std::array<u8, 0x90>, 0x20> keyblobs{}; | 148 | std::array<std::array<u8, 0x90>, 0x20> keyblobs{}; |
| 146 | 149 | ||
| @@ -148,8 +151,12 @@ private: | |||
| 148 | void LoadFromFile(const std::string& filename, bool is_title_keys); | 151 | void LoadFromFile(const std::string& filename, bool is_title_keys); |
| 149 | void AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2, | 152 | void AttemptLoadKeyFile(const std::string& dir1, const std::string& dir2, |
| 150 | const std::string& filename, bool title); | 153 | const std::string& filename, bool title); |
| 151 | template <std::size_t Size> | 154 | template <size_t Size> |
| 152 | void WriteKeyToFile(bool title_key, std::string_view keyname, const std::array<u8, Size>& key); | 155 | void WriteKeyToFile(KeyCategory category, std::string_view keyname, |
| 156 | const std::array<u8, Size>& key); | ||
| 157 | |||
| 158 | void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0); | ||
| 159 | void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0); | ||
| 153 | 160 | ||
| 154 | static const boost::container::flat_map<std::string, KeyIndex<S128KeyType>> s128_file_id; | 161 | static const boost::container::flat_map<std::string, KeyIndex<S128KeyType>> s128_file_id; |
| 155 | static const boost::container::flat_map<std::string, KeyIndex<S256KeyType>> s256_file_id; | 162 | static const boost::container::flat_map<std::string, KeyIndex<S256KeyType>> s256_file_id; |