diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/crypto/key_manager.cpp | 2 | ||||
| -rw-r--r-- | src/core/crypto/partition_data_manager.cpp | 4 | ||||
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 10 | ||||
| -rw-r--r-- | src/core/file_sys/xts_archive.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/backend/boxcat.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/bcat/module.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ldr/ldr.cpp | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/core/crypto/key_manager.cpp b/src/core/crypto/key_manager.cpp index 222fc95ba..4401f9f81 100644 --- a/src/core/crypto/key_manager.cpp +++ b/src/core/crypto/key_manager.cpp | |||
| @@ -396,7 +396,7 @@ static std::array<u8, target_size> MGF1(const std::array<u8, in_size>& seed) { | |||
| 396 | while (out.size() < target_size) { | 396 | while (out.size() < target_size) { |
| 397 | out.resize(out.size() + 0x20); | 397 | out.resize(out.size() + 0x20); |
| 398 | seed_exp[in_size + 3] = static_cast<u8>(i); | 398 | seed_exp[in_size + 3] = static_cast<u8>(i); |
| 399 | mbedtls_sha256(seed_exp.data(), seed_exp.size(), out.data() + out.size() - 0x20, 0); | 399 | mbedtls_sha256_ret(seed_exp.data(), seed_exp.size(), out.data() + out.size() - 0x20, 0); |
| 400 | ++i; | 400 | ++i; |
| 401 | } | 401 | } |
| 402 | 402 | ||
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp index 594cd82c5..a4b09fd12 100644 --- a/src/core/crypto/partition_data_manager.cpp +++ b/src/core/crypto/partition_data_manager.cpp | |||
| @@ -161,7 +161,7 @@ std::array<u8, key_size> FindKeyFromHex(const std::vector<u8>& binary, | |||
| 161 | 161 | ||
| 162 | std::array<u8, 0x20> temp{}; | 162 | std::array<u8, 0x20> temp{}; |
| 163 | for (size_t i = 0; i < binary.size() - key_size; ++i) { | 163 | for (size_t i = 0; i < binary.size() - key_size; ++i) { |
| 164 | mbedtls_sha256(binary.data() + i, key_size, temp.data(), 0); | 164 | mbedtls_sha256_ret(binary.data() + i, key_size, temp.data(), 0); |
| 165 | 165 | ||
| 166 | if (temp != hash) | 166 | if (temp != hash) |
| 167 | continue; | 167 | continue; |
| @@ -189,7 +189,7 @@ static std::array<Key128, 0x20> FindEncryptedMasterKeyFromHex(const std::vector< | |||
| 189 | AESCipher<Key128> cipher(key, Mode::ECB); | 189 | AESCipher<Key128> cipher(key, Mode::ECB); |
| 190 | for (size_t i = 0; i < binary.size() - 0x10; ++i) { | 190 | for (size_t i = 0; i < binary.size() - 0x10; ++i) { |
| 191 | cipher.Transcode(binary.data() + i, dec_temp.size(), dec_temp.data(), Op::Decrypt); | 191 | cipher.Transcode(binary.data() + i, dec_temp.size(), dec_temp.data(), Op::Decrypt); |
| 192 | mbedtls_sha256(dec_temp.data(), dec_temp.size(), temp.data(), 0); | 192 | mbedtls_sha256_ret(dec_temp.data(), dec_temp.size(), temp.data(), 0); |
| 193 | 193 | ||
| 194 | for (size_t k = 0; k < out.size(); ++k) { | 194 | for (size_t k = 0; k < out.size(); ++k) { |
| 195 | if (temp == master_key_hashes[k]) { | 195 | if (temp == master_key_hashes[k]) { |
diff --git a/src/core/file_sys/registered_cache.cpp b/src/core/file_sys/registered_cache.cpp index ac3fbd849..6e9cf67ef 100644 --- a/src/core/file_sys/registered_cache.cpp +++ b/src/core/file_sys/registered_cache.cpp | |||
| @@ -62,7 +62,7 @@ static std::string GetRelativePathFromNcaID(const std::array<u8, 16>& nca_id, bo | |||
| 62 | Common::HexToString(nca_id, second_hex_upper)); | 62 | Common::HexToString(nca_id, second_hex_upper)); |
| 63 | 63 | ||
| 64 | Core::Crypto::SHA256Hash hash{}; | 64 | Core::Crypto::SHA256Hash hash{}; |
| 65 | mbedtls_sha256(nca_id.data(), nca_id.size(), hash.data(), 0); | 65 | mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0); |
| 66 | return fmt::format(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca", hash[0], | 66 | return fmt::format(cnmt_suffix ? "/000000{:02X}/{}.cnmt.nca" : "/000000{:02X}/{}.nca", hash[0], |
| 67 | Common::HexToString(nca_id, second_hex_upper)); | 67 | Common::HexToString(nca_id, second_hex_upper)); |
| 68 | } | 68 | } |
| @@ -141,7 +141,7 @@ bool PlaceholderCache::Create(const NcaID& id, u64 size) const { | |||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | Core::Crypto::SHA256Hash hash{}; | 143 | Core::Crypto::SHA256Hash hash{}; |
| 144 | mbedtls_sha256(id.data(), id.size(), hash.data(), 0); | 144 | mbedtls_sha256_ret(id.data(), id.size(), hash.data(), 0); |
| 145 | const auto dirname = fmt::format("000000{:02X}", hash[0]); | 145 | const auto dirname = fmt::format("000000{:02X}", hash[0]); |
| 146 | 146 | ||
| 147 | const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname); | 147 | const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname); |
| @@ -165,7 +165,7 @@ bool PlaceholderCache::Delete(const NcaID& id) const { | |||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | Core::Crypto::SHA256Hash hash{}; | 167 | Core::Crypto::SHA256Hash hash{}; |
| 168 | mbedtls_sha256(id.data(), id.size(), hash.data(), 0); | 168 | mbedtls_sha256_ret(id.data(), id.size(), hash.data(), 0); |
| 169 | const auto dirname = fmt::format("000000{:02X}", hash[0]); | 169 | const auto dirname = fmt::format("000000{:02X}", hash[0]); |
| 170 | 170 | ||
| 171 | const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname); | 171 | const auto dir2 = GetOrCreateDirectoryRelative(dir, dirname); |
| @@ -603,7 +603,7 @@ InstallResult RegisteredCache::InstallEntry(const NCA& nca, TitleType type, | |||
| 603 | OptionalHeader opt_header{0, 0}; | 603 | OptionalHeader opt_header{0, 0}; |
| 604 | ContentRecord c_rec{{}, {}, {}, GetCRTypeFromNCAType(nca.GetType()), {}}; | 604 | ContentRecord c_rec{{}, {}, {}, GetCRTypeFromNCAType(nca.GetType()), {}}; |
| 605 | const auto& data = nca.GetBaseFile()->ReadBytes(0x100000); | 605 | const auto& data = nca.GetBaseFile()->ReadBytes(0x100000); |
| 606 | mbedtls_sha256(data.data(), data.size(), c_rec.hash.data(), 0); | 606 | mbedtls_sha256_ret(data.data(), data.size(), c_rec.hash.data(), 0); |
| 607 | memcpy(&c_rec.nca_id, &c_rec.hash, 16); | 607 | memcpy(&c_rec.nca_id, &c_rec.hash, 16); |
| 608 | const CNMT new_cnmt(header, opt_header, {c_rec}, {}); | 608 | const CNMT new_cnmt(header, opt_header, {c_rec}, {}); |
| 609 | if (!RawInstallYuzuMeta(new_cnmt)) | 609 | if (!RawInstallYuzuMeta(new_cnmt)) |
| @@ -626,7 +626,7 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti | |||
| 626 | id = *override_id; | 626 | id = *override_id; |
| 627 | } else { | 627 | } else { |
| 628 | const auto& data = in->ReadBytes(0x100000); | 628 | const auto& data = in->ReadBytes(0x100000); |
| 629 | mbedtls_sha256(data.data(), data.size(), hash.data(), 0); | 629 | mbedtls_sha256_ret(data.data(), data.size(), hash.data(), 0); |
| 630 | memcpy(id.data(), hash.data(), 16); | 630 | memcpy(id.data(), hash.data(), 16); |
| 631 | } | 631 | } |
| 632 | 632 | ||
diff --git a/src/core/file_sys/xts_archive.cpp b/src/core/file_sys/xts_archive.cpp index 4bc5cb2ee..944556009 100644 --- a/src/core/file_sys/xts_archive.cpp +++ b/src/core/file_sys/xts_archive.cpp | |||
| @@ -64,7 +64,7 @@ NAX::NAX(VirtualFile file_) : header(std::make_unique<NAXHeader>()), file(std::m | |||
| 64 | NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id) | 64 | NAX::NAX(VirtualFile file_, std::array<u8, 0x10> nca_id) |
| 65 | : header(std::make_unique<NAXHeader>()), file(std::move(file_)) { | 65 | : header(std::make_unique<NAXHeader>()), file(std::move(file_)) { |
| 66 | Core::Crypto::SHA256Hash hash{}; | 66 | Core::Crypto::SHA256Hash hash{}; |
| 67 | mbedtls_sha256(nca_id.data(), nca_id.size(), hash.data(), 0); | 67 | mbedtls_sha256_ret(nca_id.data(), nca_id.size(), hash.data(), 0); |
| 68 | status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0], | 68 | status = Parse(fmt::format("/registered/000000{:02X}/{}.nca", hash[0], |
| 69 | Common::HexToString(nca_id, false))); | 69 | Common::HexToString(nca_id, false))); |
| 70 | } | 70 | } |
diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 918159e11..1411a646f 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp | |||
| @@ -255,7 +255,7 @@ private: | |||
| 255 | using Digest = std::array<u8, 0x20>; | 255 | using Digest = std::array<u8, 0x20>; |
| 256 | static Digest DigestFile(std::vector<u8> bytes) { | 256 | static Digest DigestFile(std::vector<u8> bytes) { |
| 257 | Digest out{}; | 257 | Digest out{}; |
| 258 | mbedtls_sha256(bytes.data(), bytes.size(), out.data(), 0); | 258 | mbedtls_sha256_ret(bytes.data(), bytes.size(), out.data(), 0); |
| 259 | return out; | 259 | return out; |
| 260 | } | 260 | } |
| 261 | 261 | ||
diff --git a/src/core/hle/service/bcat/module.cpp b/src/core/hle/service/bcat/module.cpp index 6d9d1527d..8a7304f86 100644 --- a/src/core/hle/service/bcat/module.cpp +++ b/src/core/hle/service/bcat/module.cpp | |||
| @@ -46,7 +46,7 @@ u64 GetCurrentBuildID(const Core::System::CurrentBuildProcessID& id) { | |||
| 46 | BCATDigest DigestFile(const FileSys::VirtualFile& file) { | 46 | BCATDigest DigestFile(const FileSys::VirtualFile& file) { |
| 47 | BCATDigest out{}; | 47 | BCATDigest out{}; |
| 48 | const auto bytes = file->ReadAllBytes(); | 48 | const auto bytes = file->ReadAllBytes(); |
| 49 | mbedtls_md5(bytes.data(), bytes.size(), out.data()); | 49 | mbedtls_md5_ret(bytes.data(), bytes.size(), out.data()); |
| 50 | return out; | 50 | return out; |
| 51 | } | 51 | } |
| 52 | 52 | ||
diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 499376bfc..88f903bfd 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp | |||
| @@ -294,7 +294,7 @@ public: | |||
| 294 | Memory::ReadBlock(nro_address, nro_data.data(), nro_size); | 294 | Memory::ReadBlock(nro_address, nro_data.data(), nro_size); |
| 295 | 295 | ||
| 296 | SHA256Hash hash{}; | 296 | SHA256Hash hash{}; |
| 297 | mbedtls_sha256(nro_data.data(), nro_data.size(), hash.data(), 0); | 297 | mbedtls_sha256_ret(nro_data.data(), nro_data.size(), hash.data(), 0); |
| 298 | 298 | ||
| 299 | // NRO Hash is already loaded | 299 | // NRO Hash is already loaded |
| 300 | if (std::any_of(nro.begin(), nro.end(), [&hash](const std::pair<VAddr, NROInfo>& info) { | 300 | if (std::any_of(nro.begin(), nro.end(), [&hash](const std::pair<VAddr, NROInfo>& info) { |