summaryrefslogtreecommitdiff
path: root/src/core/crypto/key_manager.h
diff options
context:
space:
mode:
authorGravatar Zach Hilman2018-09-29 11:48:51 -0400
committerGravatar Zach Hilman2018-10-07 13:16:23 -0400
commit3ec054643e50f2845fb6a1a924b83bd71a0e2234 (patch)
tree313f2bcfba3610aa9bad98c3a7995d475712adc2 /src/core/crypto/key_manager.h
parentqt: Add rederive keyset menu option (diff)
downloadyuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.gz
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.xz
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.zip
partition_data_manager: Rename system files for hekate
x
Diffstat (limited to 'src/core/crypto/key_manager.h')
-rw-r--r--src/core/crypto/key_manager.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h
index d26aa59b6..a41abbdfc 100644
--- a/src/core/crypto/key_manager.h
+++ b/src/core/crypto/key_manager.h
@@ -11,8 +11,8 @@
11#include <boost/optional.hpp> 11#include <boost/optional.hpp>
12#include <fmt/format.h> 12#include <fmt/format.h>
13#include "common/common_types.h" 13#include "common/common_types.h"
14#include "core/crypto/partition_data_manager.h"
14#include "core/file_sys/vfs_types.h" 15#include "core/file_sys/vfs_types.h"
15#include "partition_data_manager.h"
16 16
17namespace FileUtil { 17namespace FileUtil {
18class IOFile; 18class IOFile;
@@ -154,11 +154,11 @@ public:
154 // 8*43 and the private file to exist. 154 // 8*43 and the private file to exist.
155 void DeriveSDSeedLazy(); 155 void DeriveSDSeedLazy();
156 156
157 bool BaseDeriveNecessary(); 157 bool BaseDeriveNecessary() const;
158 void DeriveBase(); 158 void DeriveBase();
159 void DeriveETicket(PartitionDataManager data); 159 void DeriveETicket(PartitionDataManager& data);
160 160
161 void PopulateFromPartitionData(PartitionDataManager data); 161 void PopulateFromPartitionData(PartitionDataManager& data);
162 162
163private: 163private:
164 std::map<KeyIndex<S128KeyType>, Key128> s128_keys; 164 std::map<KeyIndex<S128KeyType>, Key128> s128_keys;
@@ -175,6 +175,8 @@ private:
175 void WriteKeyToFile(KeyCategory category, std::string_view keyname, 175 void WriteKeyToFile(KeyCategory category, std::string_view keyname,
176 const std::array<u8, Size>& key); 176 const std::array<u8, Size>& key);
177 177
178 void DeriveGeneralPurposeKeys(u8 crypto_revision);
179
178 void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0); 180 void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0);
179 void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0); 181 void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0);
180 182
@@ -183,7 +185,11 @@ private:
183}; 185};
184 186
185Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed); 187Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed);
186Key128 DeriveKeyblobKey(Key128 sbk, Key128 tsec, Key128 source); 188Key128 DeriveKeyblobKey(const Key128& sbk, const Key128& tsec, Key128 source);
189Key128 DeriveKeyblobMACKey(const Key128& keyblob_key, const Key128& mac_source);
190Key128 DeriveMasterKey(const std::array<u8, 0x90>& keyblob, const Key128& master_source);
191std::array<u8, 0x90> DecryptKeyblob(const std::array<u8, 0xB0>& encrypted_keyblob,
192 const Key128& key);
187 193
188boost::optional<Key128> DeriveSDSeed(); 194boost::optional<Key128> DeriveSDSeed();
189Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& keys); 195Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& keys);