diff options
author | Ameer <aj662@drexel.edu> | 2020-07-14 19:04:02 +0200 |
---|---|---|
committer | Ameer <aj662@drexel.edu> | 2020-07-14 19:04:02 +0200 |
commit | 93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3 (patch) | |
tree | c4ab9e3acff296733b00effd85371bf04db6491f /src/core/crypto/key_manager.cpp | |
parent | Break out of scan loop if can't find adapter on first run (diff) | |
parent | Merge pull request #4294 from MerryMage/cpu-opt-settings (diff) | |
download | yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.gz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.bz2 yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.lz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.xz yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.tar.zst yuzu-93fe982a0c3a5bfb7fa5df97ebced0a7692ccaf3.zip |
Diffstat (limited to 'src/core/crypto/key_manager.cpp')
-rw-r--r-- | src/core/crypto/key_manager.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 8997c7082..f87fe0abc 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -695,8 +695,9 @@ void KeyManager::WriteKeyToFile(KeyCategory category, std::string_view keyname, } void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) { - if (s128_keys.find({id, field1, field2}) != s128_keys.end()) + if (s128_keys.find({id, field1, field2}) != s128_keys.end() || key == Key128{}) { return; + } if (id == S128KeyType::Titlekey) { Key128 rights_id; std::memcpy(rights_id.data(), &field2, sizeof(u64)); @@ -716,8 +717,9 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) { return std::tie(elem.second.type, elem.second.field1, elem.second.field2) == std::tie(id, field1, field2); }); - if (iter2 != s128_file_id.end()) + if (iter2 != s128_file_id.end()) { WriteKeyToFile(category, iter2->first, key); + } // Variable cases if (id == S128KeyType::KeyArea) { @@ -745,16 +747,18 @@ void KeyManager::SetKey(S128KeyType id, Key128 key, u64 field1, u64 field2) { } void KeyManager::SetKey(S256KeyType id, Key256 key, u64 field1, u64 field2) { - if (s256_keys.find({id, field1, field2}) != s256_keys.end()) + if (s256_keys.find({id, field1, field2}) != s256_keys.end() || key == Key256{}) { return; + } const auto iter = std::find_if( s256_file_id.begin(), s256_file_id.end(), [&id, &field1, &field2](const std::pair<std::string, KeyIndex<S256KeyType>> elem) { return std::tie(elem.second.type, elem.second.field1, elem.second.field2) == std::tie(id, field1, field2); }); - if (iter != s256_file_id.end()) + if (iter != s256_file_id.end()) { WriteKeyToFile(KeyCategory::Standard, iter->first, key); + } s256_keys[{id, field1, field2}] = key; } |