From 00a1d106bd11e4290ac9b9c460435c8cae3f5d6b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 1 Jul 2020 00:21:29 -0400 Subject: key_manager: Make use of canonical deleted operator= operator= typically returns a reference, it's not void. While we're at it, we can correct the parameter formatting to adhere to the codebase. --- src/core/crypto/key_manager.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index bf3434e1c..f1125e083 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -228,8 +228,8 @@ public: return instance; } - KeyManager(KeyManager const&) = delete; - void operator=(KeyManager const&) = delete; + KeyManager(const KeyManager&) = delete; + KeyManager& operator=(const KeyManager&) = delete; bool HasKey(S128KeyType id, u64 field1 = 0, u64 field2 = 0) const; bool HasKey(S256KeyType id, u64 field1 = 0, u64 field2 = 0) const; -- cgit v1.2.3 From c91710a82fc99b420dfab103fe89bdd44ba004cb Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 1 Jul 2020 00:24:35 -0400 Subject: key_manager: Delete move operations Prevents the singleton from being moved from. --- src/core/crypto/key_manager.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index f1125e083..44e7c5bb5 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -231,6 +231,9 @@ public: KeyManager(const KeyManager&) = delete; KeyManager& operator=(const KeyManager&) = delete; + KeyManager(KeyManager&&) = delete; + KeyManager& operator=(KeyManager&&) = delete; + bool HasKey(S128KeyType id, u64 field1 = 0, u64 field2 = 0) const; bool HasKey(S256KeyType id, u64 field1 = 0, u64 field2 = 0) const; -- cgit v1.2.3 From fb13f053bb6ef304bc7656b521727c87eff697f1 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 1 Jul 2020 00:28:49 -0400 Subject: key_manager: Correct casing of instance() Our codebase uppercases member function names. --- src/core/crypto/key_manager.h | 2 +- src/core/file_sys/bis_factory.cpp | 2 +- src/core/file_sys/card_image.h | 2 +- src/core/file_sys/content_archive.h | 2 +- src/core/file_sys/registered_cache.h | 2 +- src/core/file_sys/submission_package.cpp | 2 +- src/core/file_sys/submission_package.h | 2 +- src/core/file_sys/xts_archive.h | 2 +- src/core/hle/service/es/es.cpp | 2 +- src/yuzu/main.cpp | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index 44e7c5bb5..9269a73f2 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -223,7 +223,7 @@ bool operator<(const KeyIndex& lhs, const KeyIndex& rhs) { class KeyManager { public: - static KeyManager& instance() { + static KeyManager& Instance() { static KeyManager instance; return instance; } diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp index 464ca6503..8935a62c3 100644 --- a/src/core/file_sys/bis_factory.cpp +++ b/src/core/file_sys/bis_factory.cpp @@ -79,7 +79,7 @@ VirtualDir BISFactory::OpenPartition(BisPartitionId id) const { } VirtualFile BISFactory::OpenPartitionStorage(BisPartitionId id) const { - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + auto& keys = Core::Crypto::KeyManager::Instance(); Core::Crypto::PartitionDataManager pdm{ Core::System::GetInstance().GetFilesystem()->OpenDirectory( FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), Mode::Read)}; diff --git a/src/core/file_sys/card_image.h b/src/core/file_sys/card_image.h index a09d504ae..e1b136426 100644 --- a/src/core/file_sys/card_image.h +++ b/src/core/file_sys/card_image.h @@ -140,6 +140,6 @@ private: u64 update_normal_partition_end; - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; } // namespace FileSys diff --git a/src/core/file_sys/content_archive.h b/src/core/file_sys/content_archive.h index e6c887b32..d25cbcf91 100644 --- a/src/core/file_sys/content_archive.h +++ b/src/core/file_sys/content_archive.h @@ -158,7 +158,7 @@ private: bool encrypted = false; bool is_update = false; - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; } // namespace FileSys diff --git a/src/core/file_sys/registered_cache.h b/src/core/file_sys/registered_cache.h index 4b2fb08cb..f339cd17b 100644 --- a/src/core/file_sys/registered_cache.h +++ b/src/core/file_sys/registered_cache.h @@ -88,7 +88,7 @@ public: protected: // A single instance of KeyManager to be used by GetEntry() - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; class PlaceholderCache { diff --git a/src/core/file_sys/submission_package.cpp b/src/core/file_sys/submission_package.cpp index c35a0d10b..175a8266a 100644 --- a/src/core/file_sys/submission_package.cpp +++ b/src/core/file_sys/submission_package.cpp @@ -21,7 +21,7 @@ namespace FileSys { namespace { void SetTicketKeys(const std::vector& files) { - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + auto& keys = Core::Crypto::KeyManager::Instance(); for (const auto& ticket_file : files) { if (ticket_file == nullptr) { diff --git a/src/core/file_sys/submission_package.h b/src/core/file_sys/submission_package.h index bd577f6e5..cf89de6a9 100644 --- a/src/core/file_sys/submission_package.h +++ b/src/core/file_sys/submission_package.h @@ -73,7 +73,7 @@ private: std::map, std::shared_ptr>> ncas; std::vector ticket_files; - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); VirtualFile romfs; VirtualDir exefs; diff --git a/src/core/file_sys/xts_archive.h b/src/core/file_sys/xts_archive.h index 95da907bc..563531bb6 100644 --- a/src/core/file_sys/xts_archive.h +++ b/src/core/file_sys/xts_archive.h @@ -62,6 +62,6 @@ private: VirtualFile dec_file; - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; } // namespace FileSys diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index da6b74a22..a41c73c48 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp @@ -302,7 +302,7 @@ private: rb.Push(write_size); } - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); }; void InstallInterfaces(SM::ServiceManager& service_manager) { diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index f586950e7..fb299a39b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -2226,7 +2226,7 @@ void GMainWindow::OnReinitializeKeys(ReinitializeKeyBehavior behavior) { "title.keys_autogenerated"); } - Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::instance(); + Core::Crypto::KeyManager& keys = Core::Crypto::KeyManager::Instance(); if (keys.BaseDeriveNecessary()) { Core::Crypto::PartitionDataManager pdm{vfs->OpenDirectory( FileUtil::GetUserPath(FileUtil::UserPath::SysDataDir), FileSys::Mode::Read)}; -- cgit v1.2.3