diff options
author | Lioncash <mathew1800@gmail.com> | 2019-11-12 10:13:17 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-11-12 13:55:22 +0100 |
commit | 581d2e36e5af4de9c35b9b5753a6458299eb3926 (patch) | |
tree | 2b6c72ecfe45e972ec13af9585c58b0716e6b040 /src | |
parent | result: Resolve sign-coversion warnings (diff) | |
download | yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.gz yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.bz2 yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.lz yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.xz yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.zst yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/crypto/key_manager.cpp | 16 | ||||
-rw-r--r-- | src/core/crypto/partition_data_manager.cpp | 7 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 222fc95ba..023325292 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -21,6 +21,7 @@ #include "common/common_paths.h" #include "common/file_util.h" #include "common/hex_util.h" +#include "common/string_util.h" #include "common/logging/log.h" #include "core/core.h" #include "core/crypto/aes_util.h" @@ -378,8 +379,9 @@ std::vector<Ticket> GetTicketblob(const FileUtil::IOFile& ticket_save) { template <size_t size> static std::array<u8, size> operator^(const std::array<u8, size>& lhs, const std::array<u8, size>& rhs) { - std::array<u8, size> out{}; - std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), std::bit_xor<>()); + std::array<u8, size> out; + std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), + [](u8 lhs, u8 rhs) { return u8(lhs ^ rhs); }); return out; } @@ -538,7 +540,7 @@ void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) { Key128 key = Common::HexStringToArray<16>(out[1]); s128_keys[{S128KeyType::Titlekey, rights_id[1], rights_id[0]}] = key; } else { - std::transform(out[0].begin(), out[0].end(), out[0].begin(), ::tolower); + out[0] = Common::ToLower(out[0]); if (s128_file_id.find(out[0]) != s128_file_id.end()) { const auto index = s128_file_id.at(out[0]); Key128 key = Common::HexStringToArray<16>(out[1]); @@ -944,12 +946,10 @@ void KeyManager::DeriveETicket(PartitionDataManager& data) { return; } - Key128 rsa_oaep_kek{}; - std::transform(seed3.begin(), seed3.end(), mask0.begin(), rsa_oaep_kek.begin(), - std::bit_xor<>()); - - if (rsa_oaep_kek == Key128{}) + const Key128 rsa_oaep_kek = seed3 ^ mask0; + if (rsa_oaep_kek == Key128{}) { return; + } SetKey(S128KeyType::Source, rsa_oaep_kek, static_cast<u64>(SourceKeyType::RSAOaepKekGeneration)); diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp index 594cd82c5..e82522756 100644 --- a/src/core/crypto/partition_data_manager.cpp +++ b/src/core/crypto/partition_data_manager.cpp @@ -204,11 +204,12 @@ static std::array<Key128, 0x20> FindEncryptedMasterKeyFromHex(const std::vector< FileSys::VirtualFile FindFileInDirWithNames(const FileSys::VirtualDir& dir, const std::string& name) { - auto upper = name; - std::transform(upper.begin(), upper.end(), upper.begin(), [](u8 c) { return std::toupper(c); }); + const auto upper = Common::ToUpper(name); + for (const auto& fname : {name, name + ".bin", upper, upper + ".BIN"}) { - if (dir->GetFile(fname) != nullptr) + if (dir->GetFile(fname) != nullptr) { return dir->GetFile(fname); + } } return nullptr; |