diff options
Diffstat (limited to 'src/core/crypto')
| -rw-r--r-- | src/core/crypto/ctr_encryption_layer.h | 2 | ||||
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 8 | ||||
| -rw-r--r-- | src/core/crypto/key_manager.h | 5 | ||||
| -rw-r--r-- | src/core/crypto/xts_encryption_layer.h | 2 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/core/crypto/ctr_encryption_layer.h b/src/core/crypto/ctr_encryption_layer.h index 77f08d776..d85ad8f78 100644 --- a/src/core/crypto/ctr_encryption_layer.h +++ b/src/core/crypto/ctr_encryption_layer.h @@ -11,7 +11,7 @@ namespace Core::Crypto { -// Sits on top of a VirtualFile and provides CTR-mode AES decription. +// Sits on top of a VirtualFile and provides CTR-mode AES description. class CTREncryptionLayer : public EncryptionLayer { public: using IVData = std::array<u8, 16>; diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 65a9fe802..4ff2c50e5 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -569,6 +569,10 @@ std::optional<std::pair<Key128, Key128>> ParseTicket(const Ticket& ticket, } KeyManager::KeyManager() { + ReloadKeys(); +} + +void KeyManager::ReloadKeys() { // Initialize keys const auto yuzu_keys_dir = Common::FS::GetYuzuPath(Common::FS::YuzuPath::KeysDir); @@ -702,6 +706,10 @@ void KeyManager::LoadFromFile(const std::filesystem::path& file_path, bool is_ti } } +bool KeyManager::AreKeysLoaded() const { + return !s128_keys.empty() && !s256_keys.empty(); +} + bool KeyManager::BaseDeriveNecessary() const { const auto check_key_existence = [this](auto key_type, u64 index1 = 0, u64 index2 = 0) { return !HasKey(key_type, index1, index2); diff --git a/src/core/crypto/key_manager.h b/src/core/crypto/key_manager.h index dbf9ebfe4..8c864503b 100644 --- a/src/core/crypto/key_manager.h +++ b/src/core/crypto/key_manager.h @@ -249,7 +249,7 @@ public: static bool KeyFileExists(bool title); - // Call before using the sd seed to attempt to derive it if it dosen't exist. Needs system + // Call before using the sd seed to attempt to derive it if it doesn't exist. Needs system // save 8*43 and the private file to exist. void DeriveSDSeedLazy(); @@ -267,6 +267,9 @@ public: bool AddTicketCommon(Ticket raw); bool AddTicketPersonalized(Ticket raw); + void ReloadKeys(); + bool AreKeysLoaded() const; + private: KeyManager(); diff --git a/src/core/crypto/xts_encryption_layer.h b/src/core/crypto/xts_encryption_layer.h index 735e660cb..68b5643b1 100644 --- a/src/core/crypto/xts_encryption_layer.h +++ b/src/core/crypto/xts_encryption_layer.h @@ -9,7 +9,7 @@ namespace Core::Crypto { -// Sits on top of a VirtualFile and provides XTS-mode AES decription. +// Sits on top of a VirtualFile and provides XTS-mode AES description. class XTSEncryptionLayer : public EncryptionLayer { public: XTSEncryptionLayer(FileSys::VirtualFile base, Key256 key); |
