Просмотр исходного кода

Merge pull request #4652 from lioncash/crypto

crypto/key_manager: Remove dependency on the global system accessor
Rodrigo Locatti 5 лет назад
Родитель
Сommit
0bac7b6a95
3 измененных файлов с 12 добавлено и 7 удалено
  1. 3 4
      src/core/crypto/key_manager.cpp
  2. 5 1
      src/core/crypto/key_manager.h
  3. 4 2
      src/yuzu/main.cpp

+ 3 - 4
src/core/crypto/key_manager.cpp

@@ -23,7 +23,6 @@
 #include "common/hex_util.h"
 #include "common/hex_util.h"
 #include "common/logging/log.h"
 #include "common/logging/log.h"
 #include "common/string_util.h"
 #include "common/string_util.h"
-#include "core/core.h"
 #include "core/crypto/aes_util.h"
 #include "core/crypto/aes_util.h"
 #include "core/crypto/key_manager.h"
 #include "core/crypto/key_manager.h"
 #include "core/crypto/partition_data_manager.h"
 #include "core/crypto/partition_data_manager.h"
@@ -1022,10 +1021,10 @@ void KeyManager::DeriveBase() {
     }
     }
 }
 }
 
 
-void KeyManager::DeriveETicket(PartitionDataManager& data) {
+void KeyManager::DeriveETicket(PartitionDataManager& data,
+                               const FileSys::ContentProvider& provider) {
     // ETicket keys
     // ETicket keys
-    const auto es = Core::System::GetInstance().GetContentProvider().GetEntry(
-        0x0100000000000033, FileSys::ContentRecordType::Program);
+    const auto es = provider.GetEntry(0x0100000000000033, FileSys::ContentRecordType::Program);
 
 
     if (es == nullptr) {
     if (es == nullptr) {
         return;
         return;

+ 5 - 1
src/core/crypto/key_manager.h

@@ -20,6 +20,10 @@ namespace Common::FS {
 class IOFile;
 class IOFile;
 }
 }
 
 
+namespace FileSys {
+class ContentProvider;
+}
+
 namespace Loader {
 namespace Loader {
 enum class ResultStatus : u16;
 enum class ResultStatus : u16;
 }
 }
@@ -252,7 +256,7 @@ public:
 
 
     bool BaseDeriveNecessary() const;
     bool BaseDeriveNecessary() const;
     void DeriveBase();
     void DeriveBase();
-    void DeriveETicket(PartitionDataManager& data);
+    void DeriveETicket(PartitionDataManager& data, const FileSys::ContentProvider& provider);
     void PopulateTickets();
     void PopulateTickets();
     void SynthesizeTickets();
     void SynthesizeTickets();
 
 

+ 4 - 2
src/yuzu/main.cpp

@@ -2592,8 +2592,10 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) {
 
 
         const auto function = [this, &keys, &pdm] {
         const auto function = [this, &keys, &pdm] {
             keys.PopulateFromPartitionData(pdm);
             keys.PopulateFromPartitionData(pdm);
-            Core::System::GetInstance().GetFileSystemController().CreateFactories(*vfs);
-            keys.DeriveETicket(pdm);
+
+            auto& system = Core::System::GetInstance();
+            system.GetFileSystemController().CreateFactories(*vfs);
+            keys.DeriveETicket(pdm, system.GetContentProvider());
         };
         };
 
 
         QString errors;
         QString errors;