summaryrefslogtreecommitdiffstats
path: root/src/core/crypto/key_manager.h
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-09-29 17:48:51 +0200
committerZach Hilman <zachhilman@gmail.com>2018-10-07 19:16:23 +0200
commit3ec054643e50f2845fb6a1a924b83bd71a0e2234 (patch)
tree313f2bcfba3610aa9bad98c3a7995d475712adc2 /src/core/crypto/key_manager.h
parentqt: Add rederive keyset menu option (diff)
downloadyuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.gz
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.bz2
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.lz
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.xz
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.tar.zst
yuzu-3ec054643e50f2845fb6a1a924b83bd71a0e2234.zip
Diffstat (limited to '')
-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 @@
#include <boost/optional.hpp>
#include <fmt/format.h>
#include "common/common_types.h"
+#include "core/crypto/partition_data_manager.h"
#include "core/file_sys/vfs_types.h"
-#include "partition_data_manager.h"
namespace FileUtil {
class IOFile;
@@ -154,11 +154,11 @@ public:
// 8*43 and the private file to exist.
void DeriveSDSeedLazy();
- bool BaseDeriveNecessary();
+ bool BaseDeriveNecessary() const;
void DeriveBase();
- void DeriveETicket(PartitionDataManager data);
+ void DeriveETicket(PartitionDataManager& data);
- void PopulateFromPartitionData(PartitionDataManager data);
+ void PopulateFromPartitionData(PartitionDataManager& data);
private:
std::map<KeyIndex<S128KeyType>, Key128> s128_keys;
@@ -175,6 +175,8 @@ private:
void WriteKeyToFile(KeyCategory category, std::string_view keyname,
const std::array<u8, Size>& key);
+ void DeriveGeneralPurposeKeys(u8 crypto_revision);
+
void SetKeyWrapped(S128KeyType id, Key128 key, u64 field1 = 0, u64 field2 = 0);
void SetKeyWrapped(S256KeyType id, Key256 key, u64 field1 = 0, u64 field2 = 0);
@@ -183,7 +185,11 @@ private:
};
Key128 GenerateKeyEncryptionKey(Key128 source, Key128 master, Key128 kek_seed, Key128 key_seed);
-Key128 DeriveKeyblobKey(Key128 sbk, Key128 tsec, Key128 source);
+Key128 DeriveKeyblobKey(const Key128& sbk, const Key128& tsec, Key128 source);
+Key128 DeriveKeyblobMACKey(const Key128& keyblob_key, const Key128& mac_source);
+Key128 DeriveMasterKey(const std::array<u8, 0x90>& keyblob, const Key128& master_source);
+std::array<u8, 0x90> DecryptKeyblob(const std::array<u8, 0xB0>& encrypted_keyblob,
+ const Key128& key);
boost::optional<Key128> DeriveSDSeed();
Loader::ResultStatus DeriveSDKeys(std::array<Key256, 2>& sd_keys, KeyManager& keys);