diff options
| author | 2019-11-14 13:47:23 -0500 | |
|---|---|---|
| committer | 2019-11-14 13:47:23 -0500 | |
| commit | 360b0d1b3028a845948d47651bf25492273ce125 (patch) | |
| tree | ad9518767d3c9a820b6a1dc329d2290249321090 /src/core/file_sys | |
| parent | Merge pull request #3092 from lioncash/util (diff) | |
| parent | core: Migrate off deprecated mbedtls functions (diff) | |
| download | yuzu-360b0d1b3028a845948d47651bf25492273ce125.tar.gz yuzu-360b0d1b3028a845948d47651bf25492273ce125.tar.xz yuzu-360b0d1b3028a845948d47651bf25492273ce125.zip | |
Merge pull request #3093 from lioncash/mbedtls
core: Migrate off deprecated mbedtls functions
Diffstat (limited to 'src/core/file_sys')
| -rw-r--r-- | src/core/file_sys/registered_cache.cpp | 10 | ||||
| -rw-r--r-- | src/core/file_sys/xts_archive.cpp | 2 |
2 files changed, 6 insertions, 6 deletions
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 f5f8b91c9..7ca375791 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 | } |