From 581d2e36e5af4de9c35b9b5753a6458299eb3926 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 12 Nov 2019 04:13:17 -0500 Subject: crypto: Resolve sign-conversion warnings --- src/core/crypto/key_manager.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/core/crypto/key_manager.cpp') 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 GetTicketblob(const FileUtil::IOFile& ticket_save) { template static std::array operator^(const std::array& lhs, const std::array& rhs) { - std::array out{}; - std::transform(lhs.begin(), lhs.end(), rhs.begin(), out.begin(), std::bit_xor<>()); + std::array 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(SourceKeyType::RSAOaepKekGeneration)); -- cgit v1.2.3 From 47a6bb2d5ba9c8488ef1588c99fbebd8d9417374 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 12 Nov 2019 06:56:31 -0500 Subject: externals: Update httplib Since the introduction of this library, numerous improvements have been made. Notably, many of the warnings we would get by simply including the library header have now been fixed. This makes it much easier to make conversion warning an error. --- src/core/crypto/key_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/crypto/key_manager.cpp') diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 023325292..85a183dd4 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp @@ -21,8 +21,8 @@ #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 "common/string_util.h" #include "core/core.h" #include "core/crypto/aes_util.h" #include "core/crypto/key_manager.h" -- cgit v1.2.3