summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2020-09-14 16:47:25 -0400
committerGravatar Lioncash2020-09-14 16:49:59 -0400
commite0dd440b1ff9bf4578d7b69912dfe4283bfd4e6a (patch)
tree3ef2537360711465dc0b08a79aa22a4180aa4f49 /src
parentMerge pull request #4651 from lioncash/kernel-global (diff)
downloadyuzu-e0dd440b1ff9bf4578d7b69912dfe4283bfd4e6a.tar.gz
yuzu-e0dd440b1ff9bf4578d7b69912dfe4283bfd4e6a.tar.xz
yuzu-e0dd440b1ff9bf4578d7b69912dfe4283bfd4e6a.zip
crypto/key_manager: Remove dependency on the global system accessor
We can supply the content provider as an argument instead of hardcoding a global accessor in the implementation.
Diffstat (limited to 'src')
-rw-r--r--src/core/crypto/key_manager.cpp7
-rw-r--r--src/core/crypto/key_manager.h6
-rw-r--r--src/yuzu/main.cpp6
3 files changed, 12 insertions, 7 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp
index dc591c730..65d246050 100644
--- a/src/core/crypto/key_manager.cpp
+++ b/src/core/crypto/key_manager.cpp
@@ -23,7 +23,6 @@
23#include "common/hex_util.h" 23#include "common/hex_util.h"
24#include "common/logging/log.h" 24#include "common/logging/log.h"
25#include "common/string_util.h" 25#include "common/string_util.h"
26#include "core/core.h"
27#include "core/crypto/aes_util.h" 26#include "core/crypto/aes_util.h"
28#include "core/crypto/key_manager.h" 27#include "core/crypto/key_manager.h"
29#include "core/crypto/partition_data_manager.h" 28#include "core/crypto/partition_data_manager.h"
@@ -1022,10 +1021,10 @@ void KeyManager::DeriveBase() {
1022 } 1021 }
1023} 1022}
1024 1023
1025void KeyManager::DeriveETicket(PartitionDataManager& data) { 1024void KeyManager::DeriveETicket(PartitionDataManager& data,
1025 const FileSys::ContentProvider& provider) {
1026 // ETicket keys 1026 // ETicket keys
1027 const auto es = Core::System::GetInstance().GetContentProvider().GetEntry( 1027 const auto es = provider.GetEntry(0x0100000000000033, FileSys::ContentRecordType::Program);
1028 0x0100000000000033, FileSys::ContentRecordType::Program);
1029 1028
1030 if (es == nullptr) { 1029 if (es == nullptr) {
1031 return; 1030 return;
diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h
index 321b75323..0a7220286 100644
--- a/src/core/crypto/key_manager.h
+++ b/src/core/crypto/key_manager.h
@@ -20,6 +20,10 @@ namespace Common::FS {
20class IOFile; 20class IOFile;
21} 21}
22 22
23namespace FileSys {
24class ContentProvider;
25}
26
23namespace Loader { 27namespace Loader {
24enum class ResultStatus : u16; 28enum class ResultStatus : u16;
25} 29}
@@ -252,7 +256,7 @@ public:
252 256
253 bool BaseDeriveNecessary() const; 257 bool BaseDeriveNecessary() const;
254 void DeriveBase(); 258 void DeriveBase();
255 void DeriveETicket(PartitionDataManager& data); 259 void DeriveETicket(PartitionDataManager& data, const FileSys::ContentProvider& provider);
256 void PopulateTickets(); 260 void PopulateTickets();
257 void SynthesizeTickets(); 261 void SynthesizeTickets();
258 262
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 68ad43a80..bb3a08ac7 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -2592,8 +2592,10 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
2592 2592
2593 const auto function = [this, &keys, &pdm] { 2593 const auto function = [this, &keys, &pdm] {
2594 keys.PopulateFromPartitionData(pdm); 2594 keys.PopulateFromPartitionData(pdm);
2595 Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs); 2595
2596 keys.DeriveETicket(pdm); 2596 auto& system = Core::System::GetInstance();
2597 system.GetFileSystemController().CreateFactories(*vfs);
2598 keys.DeriveETicket(pdm, system.GetContentProvider());
2597 }; 2599 };
2598 2600
2599 QString errors; 2601 QString errors;