diff options
| -rw-r--r-- | src/core/crypto/aes_util.cpp | 6 | ||||
| -rw-r--r-- | src/core/crypto/aes_util.h | 8 | ||||
| -rw-r--r-- | src/core/file_sys/program_metadata.h | 6 | ||||
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/lbl/lbl.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/lm/lm.cpp | 13 |
6 files changed, 18 insertions, 21 deletions
diff --git a/src/core/crypto/aes_util.cpp b/src/core/crypto/aes_util.cpp index cb7506241..85a666de9 100644 --- a/src/core/crypto/aes_util.cpp +++ b/src/core/crypto/aes_util.cpp | |||
| @@ -119,9 +119,9 @@ void AESCipher<Key, KeySize>::XTSTranscode(const u8* src, std::size_t size, u8* | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | template <typename Key, std::size_t KeySize> | 121 | template <typename Key, std::size_t KeySize> |
| 122 | void AESCipher<Key, KeySize>::SetIVImpl(const u8* data, std::size_t size) { | 122 | void AESCipher<Key, KeySize>::SetIV(std::span<const u8> data) { |
| 123 | ASSERT_MSG((mbedtls_cipher_set_iv(&ctx->encryption_context, data, size) || | 123 | ASSERT_MSG((mbedtls_cipher_set_iv(&ctx->encryption_context, data.data(), data.size()) || |
| 124 | mbedtls_cipher_set_iv(&ctx->decryption_context, data, size)) == 0, | 124 | mbedtls_cipher_set_iv(&ctx->decryption_context, data.data(), data.size())) == 0, |
| 125 | "Failed to set IV on mbedtls ciphers."); | 125 | "Failed to set IV on mbedtls ciphers."); |
| 126 | } | 126 | } |
| 127 | 127 | ||
diff --git a/src/core/crypto/aes_util.h b/src/core/crypto/aes_util.h index e2a304186..230451b8f 100644 --- a/src/core/crypto/aes_util.h +++ b/src/core/crypto/aes_util.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <span> | ||
| 8 | #include <type_traits> | 9 | #include <type_traits> |
| 9 | #include "common/common_types.h" | 10 | #include "common/common_types.h" |
| 10 | #include "core/file_sys/vfs.h" | 11 | #include "core/file_sys/vfs.h" |
| @@ -33,10 +34,7 @@ public: | |||
| 33 | AESCipher(Key key, Mode mode); | 34 | AESCipher(Key key, Mode mode); |
| 34 | ~AESCipher(); | 35 | ~AESCipher(); |
| 35 | 36 | ||
| 36 | template <typename ContiguousContainer> | 37 | void SetIV(std::span<const u8> data); |
| 37 | void SetIV(const ContiguousContainer& container) { | ||
| 38 | SetIVImpl(std::data(container), std::size(container)); | ||
| 39 | } | ||
| 40 | 38 | ||
| 41 | template <typename Source, typename Dest> | 39 | template <typename Source, typename Dest> |
| 42 | void Transcode(const Source* src, std::size_t size, Dest* dest, Op op) const { | 40 | void Transcode(const Source* src, std::size_t size, Dest* dest, Op op) const { |
| @@ -60,8 +58,6 @@ public: | |||
| 60 | std::size_t sector_size, Op op); | 58 | std::size_t sector_size, Op op); |
| 61 | 59 | ||
| 62 | private: | 60 | private: |
| 63 | void SetIVImpl(const u8* data, std::size_t size); | ||
| 64 | |||
| 65 | std::unique_ptr<CipherContext> ctx; | 61 | std::unique_ptr<CipherContext> ctx; |
| 66 | }; | 62 | }; |
| 67 | } // namespace Core::Crypto | 63 | } // namespace Core::Crypto |
diff --git a/src/core/file_sys/program_metadata.h b/src/core/file_sys/program_metadata.h index c505f5a89..1eee916be 100644 --- a/src/core/file_sys/program_metadata.h +++ b/src/core/file_sys/program_metadata.h | |||
| @@ -44,6 +44,12 @@ public: | |||
| 44 | ProgramMetadata(); | 44 | ProgramMetadata(); |
| 45 | ~ProgramMetadata(); | 45 | ~ProgramMetadata(); |
| 46 | 46 | ||
| 47 | ProgramMetadata(const ProgramMetadata&) = default; | ||
| 48 | ProgramMetadata& operator=(const ProgramMetadata&) = default; | ||
| 49 | |||
| 50 | ProgramMetadata(ProgramMetadata&&) = default; | ||
| 51 | ProgramMetadata& operator=(ProgramMetadata&&) = default; | ||
| 52 | |||
| 47 | /// Gets a default ProgramMetadata configuration, should only be used for homebrew formats where | 53 | /// Gets a default ProgramMetadata configuration, should only be used for homebrew formats where |
| 48 | /// we do not have an NPDM file | 54 | /// we do not have an NPDM file |
| 49 | static ProgramMetadata GetDefault(); | 55 | static ProgramMetadata GetDefault(); |
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 52535ecc0..5450dcf0f 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -702,16 +702,12 @@ void Module::Interface::IsUserRegistrationRequestPermitted(Kernel::HLERequestCon | |||
| 702 | } | 702 | } |
| 703 | 703 | ||
| 704 | void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { | 704 | void Module::Interface::InitializeApplicationInfo(Kernel::HLERequestContext& ctx) { |
| 705 | IPC::RequestParser rp{ctx}; | ||
| 706 | |||
| 707 | LOG_DEBUG(Service_ACC, "called"); | 705 | LOG_DEBUG(Service_ACC, "called"); |
| 708 | IPC::ResponseBuilder rb{ctx, 2}; | 706 | IPC::ResponseBuilder rb{ctx, 2}; |
| 709 | rb.Push(InitializeApplicationInfoBase()); | 707 | rb.Push(InitializeApplicationInfoBase()); |
| 710 | } | 708 | } |
| 711 | 709 | ||
| 712 | void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx) { | 710 | void Module::Interface::InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx) { |
| 713 | IPC::RequestParser rp{ctx}; | ||
| 714 | |||
| 715 | LOG_WARNING(Service_ACC, "(Partial implementation) called"); | 711 | LOG_WARNING(Service_ACC, "(Partial implementation) called"); |
| 716 | 712 | ||
| 717 | // TODO(ogniK): We require checking if the user actually owns the title and what not. As of | 713 | // TODO(ogniK): We require checking if the user actually owns the title and what not. As of |
diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index f4490f3d9..e11a0c45a 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp | |||
| @@ -79,7 +79,6 @@ private: | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | void GetCurrentBrightnessSetting(Kernel::HLERequestContext& ctx) { | 81 | void GetCurrentBrightnessSetting(Kernel::HLERequestContext& ctx) { |
| 82 | IPC::RequestParser rp{ctx}; | ||
| 83 | auto brightness = current_brightness; | 82 | auto brightness = current_brightness; |
| 84 | if (!std::isfinite(brightness)) { | 83 | if (!std::isfinite(brightness)) { |
| 85 | LOG_ERROR(Service_LBL, "Brightness is infinite!"); | 84 | LOG_ERROR(Service_LBL, "Brightness is infinite!"); |
| @@ -272,7 +271,6 @@ private: | |||
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | void GetCurrentBrightnessSettingForVrMode(Kernel::HLERequestContext& ctx) { | 273 | void GetCurrentBrightnessSettingForVrMode(Kernel::HLERequestContext& ctx) { |
| 275 | IPC::RequestParser rp{ctx}; | ||
| 276 | auto brightness = current_vr_brightness; | 274 | auto brightness = current_vr_brightness; |
| 277 | if (!std::isfinite(brightness)) { | 275 | if (!std::isfinite(brightness)) { |
| 278 | LOG_ERROR(Service_LBL, "Brightness is infinite!"); | 276 | LOG_ERROR(Service_LBL, "Brightness is infinite!"); |
diff --git a/src/core/hle/service/lm/lm.cpp b/src/core/hle/service/lm/lm.cpp index 7d7542fc2..9bcf8870d 100644 --- a/src/core/hle/service/lm/lm.cpp +++ b/src/core/hle/service/lm/lm.cpp | |||
| @@ -46,7 +46,7 @@ struct hash<Service::LM::LogPacketHeaderEntry> { | |||
| 46 | boost::hash_combine(seed, k.severity); | 46 | boost::hash_combine(seed, k.severity); |
| 47 | boost::hash_combine(seed, k.verbosity); | 47 | boost::hash_combine(seed, k.verbosity); |
| 48 | return seed; | 48 | return seed; |
| 49 | }; | 49 | } |
| 50 | }; | 50 | }; |
| 51 | } // namespace std | 51 | } // namespace std |
| 52 | 52 | ||
| @@ -95,7 +95,7 @@ private: | |||
| 95 | std::memcpy(&header, data.data(), sizeof(LogPacketHeader)); | 95 | std::memcpy(&header, data.data(), sizeof(LogPacketHeader)); |
| 96 | offset += sizeof(LogPacketHeader); | 96 | offset += sizeof(LogPacketHeader); |
| 97 | 97 | ||
| 98 | LogPacketHeaderEntry entry{ | 98 | const LogPacketHeaderEntry entry{ |
| 99 | .pid = header.pid, | 99 | .pid = header.pid, |
| 100 | .tid = header.tid, | 100 | .tid = header.tid, |
| 101 | .severity = header.severity, | 101 | .severity = header.severity, |
| @@ -105,16 +105,17 @@ private: | |||
| 105 | if (True(header.flags & LogPacketFlags::Head)) { | 105 | if (True(header.flags & LogPacketFlags::Head)) { |
| 106 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); | 106 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); |
| 107 | std::memcpy(tmp.data(), data.data() + offset, tmp.size()); | 107 | std::memcpy(tmp.data(), data.data() + offset, tmp.size()); |
| 108 | entries[entry] = std::move(tmp); | 108 | entries.insert_or_assign(entry, std::move(tmp)); |
| 109 | } else { | 109 | } else { |
| 110 | const auto entry_iter = entries.find(entry); | ||
| 111 | |||
| 110 | // Append to existing entry | 112 | // Append to existing entry |
| 111 | if (!entries.contains(entry)) { | 113 | if (entry_iter == entries.cend()) { |
| 112 | LOG_ERROR(Service_LM, "Log entry does not exist!"); | 114 | LOG_ERROR(Service_LM, "Log entry does not exist!"); |
| 113 | return; | 115 | return; |
| 114 | } | 116 | } |
| 115 | std::vector<u8> tmp(data.size() - sizeof(LogPacketHeader)); | ||
| 116 | 117 | ||
| 117 | auto& existing_entry = entries[entry]; | 118 | auto& existing_entry = entry_iter->second; |
| 118 | const auto base = existing_entry.size(); | 119 | const auto base = existing_entry.size(); |
| 119 | existing_entry.resize(base + (data.size() - sizeof(LogPacketHeader))); | 120 | existing_entry.resize(base + (data.size() - sizeof(LogPacketHeader))); |
| 120 | std::memcpy(existing_entry.data() + base, data.data() + offset, | 121 | std::memcpy(existing_entry.data() + base, data.data() + offset, |