diff options
| author | 2019-11-12 04:13:17 -0500 | |
|---|---|---|
| committer | 2019-11-12 07:55:22 -0500 | |
| commit | 581d2e36e5af4de9c35b9b5753a6458299eb3926 (patch) | |
| tree | 2b6c72ecfe45e972ec13af9585c58b0716e6b040 /src/core/crypto/key_manager.cpp | |
| parent | result: Resolve sign-coversion warnings (diff) | |
| download | yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.gz yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.tar.xz yuzu-581d2e36e5af4de9c35b9b5753a6458299eb3926.zip | |
crypto: Resolve sign-conversion warnings
Diffstat (limited to 'src/core/crypto/key_manager.cpp')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 16 |
1 files changed, 8 insertions, 8 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 @@ | |||
| 21 | #include "common/common_paths.h" | 21 | #include "common/common_paths.h" |
| 22 | #include "common/file_util.h" | 22 | #include "common/file_util.h" |
| 23 | #include "common/hex_util.h" | 23 | #include "common/hex_util.h" |
| 24 | #include "common/string_util.h" | ||
| 24 | #include "common/logging/log.h" | 25 | #include "common/logging/log.h" |
| 25 | #include "core/core.h" | 26 | #include "core/core.h" |
| 26 | #include "core/crypto/aes_util.h" | 27 | #include "core/crypto/aes_util.h" |
| @@ -378,8 +379,9 @@ std::vector<Ticket> GetTicketblob(const FileUtil::IOFile& ticket_save) { | |||
| 378 | template <size_t size> | 379 | template <size_t size> |
| 379 | static std::array<u8, size> operator^(const std::array<u8, size>& lhs, | 380 | static std::array<u8, size> operator^(const std::array<u8, size>& lhs, |
| 380 | const std::array<u8, size>& rhs) { | 381 | const std::array<u8, size>& rhs) { |
| 381 | std::array<u8, size> out{}; | 382 | std::array<u8, size> out; |
| 382 | std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), std::bit_xor<>()); | 383 | std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), |
| 384 | [](u8 lhs, u8 rhs) { return u8(lhs ^ rhs); }); | ||
| 383 | return out; | 385 | return out; |
| 384 | } | 386 | } |
| 385 | 387 | ||
| @@ -538,7 +540,7 @@ void KeyManager::LoadFromFile(const std::string& filename, bool is_title_keys) { | |||
| 538 | Key128 key = Common::HexStringToArray<16>(out[1]); | 540 | Key128 key = Common::HexStringToArray<16>(out[1]); |
| 539 | s128_keys[{S128KeyType::Titlekey, rights_id[1], rights_id[0]}] = key; | 541 | s128_keys[{S128KeyType::Titlekey, rights_id[1], rights_id[0]}] = key; |
| 540 | } else { | 542 | } else { |
| 541 | std::transform(out[0].begin(), out[0].end(), out[0].begin(), ::tolower); | 543 | out[0] = Common::ToLower(out[0]); |
| 542 | if (s128_file_id.find(out[0]) != s128_file_id.end()) { | 544 | if (s128_file_id.find(out[0]) != s128_file_id.end()) { |
| 543 | const auto index = s128_file_id.at(out[0]); | 545 | const auto index = s128_file_id.at(out[0]); |
| 544 | Key128 key = Common::HexStringToArray<16>(out[1]); | 546 | Key128 key = Common::HexStringToArray<16>(out[1]); |
| @@ -944,12 +946,10 @@ void KeyManager::DeriveETicket(PartitionDataManager& data) { | |||
| 944 | return; | 946 | return; |
| 945 | } | 947 | } |
| 946 | 948 | ||
| 947 | Key128 rsa_oaep_kek{}; | 949 | const Key128 rsa_oaep_kek = seed3 ^ mask0; |
| 948 | std::transform(seed3.begin(), seed3.end(), mask0.begin(), rsa_oaep_kek.begin(), | 950 | if (rsa_oaep_kek == Key128{}) { |
| 949 | std::bit_xor<>()); | ||
| 950 | |||
| 951 | if (rsa_oaep_kek == Key128{}) | ||
| 952 | return; | 951 | return; |
| 952 | } | ||
| 953 | 953 | ||
| 954 | SetKey(S128KeyType::Source, rsa_oaep_kek, | 954 | SetKey(S128KeyType::Source, rsa_oaep_kek, |
| 955 | static_cast<u64>(SourceKeyType::RSAOaepKekGeneration)); | 955 | static_cast<u64>(SourceKeyType::RSAOaepKekGeneration)); |