diff --git a/rpcs3/Crypto/decrypt_binaries.cpp b/rpcs3/Crypto/decrypt_binaries.cpp index c0ee5a4abe..e47160fa58 100644 --- a/rpcs3/Crypto/decrypt_binaries.cpp +++ b/rpcs3/Crypto/decrypt_binaries.cpp @@ -106,7 +106,7 @@ usz decrypt_binaries_t::decrypt(std::string klic_input) case "NPD\0"_u32: { // EDAT / SDAT - elf_file = DecryptEDAT(elf_file, old_path, key_it != 0 ? 8 : 1, reinterpret_cast(&m_klics[key_it]), true); + elf_file = DecryptEDAT(elf_file, old_path, key_it != 0 ? 8 : 1, reinterpret_cast(&m_klics[key_it])); if (!elf_file) { diff --git a/rpcs3/Crypto/unedat.cpp b/rpcs3/Crypto/unedat.cpp index 590037f4f0..845ce21cfb 100644 --- a/rpcs3/Crypto/unedat.cpp +++ b/rpcs3/Crypto/unedat.cpp @@ -718,7 +718,7 @@ bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& inpu } // Decrypts full file -fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic, bool verbose) +fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic) { if (!input) { @@ -853,12 +853,11 @@ bool EDATADecrypter::ReadHeader() // k the ecdsa_verify function in this check_data function takes a ridiculous amount of time // like it slows down load time by a factor of x20, at least, so its ignored for now - - if (false && !check_data(reinterpret_cast(&dec_key), &edatHeader, &npdHeader, &edata_file, false)) - { - edat_log.error("NPDRM check_data() failed!"); - return false; - } + //if (!check_data(reinterpret_cast(&dec_key), &edatHeader, &npdHeader, &edata_file, false)) + //{ + // edat_log.error("NPDRM check_data() failed!"); + // return false; + //} file_size = edatHeader.file_size; total_blocks = ::narrow(utils::aligned_div(edatHeader.file_size, edatHeader.block_size)); diff --git a/rpcs3/Crypto/unedat.h b/rpcs3/Crypto/unedat.h index e61ce2c502..fa26da2f42 100644 --- a/rpcs3/Crypto/unedat.h +++ b/rpcs3/Crypto/unedat.h @@ -62,7 +62,7 @@ struct EDAT_HEADER }; // Decrypts full file, or null/empty file -extern fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic, bool verbose); +extern fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic); extern void read_npd_edat_header(const fs::file* input, NPD_HEADER& NPD, EDAT_HEADER& EDAT); extern bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& input_file_name, const u8* custom_klic, NPD_HEADER *npd_out = nullptr); diff --git a/rpcs3/Crypto/unpkg.cpp b/rpcs3/Crypto/unpkg.cpp index e92c00449b..e7149bcd58 100644 --- a/rpcs3/Crypto/unpkg.cpp +++ b/rpcs3/Crypto/unpkg.cpp @@ -862,7 +862,7 @@ bool package_reader::fill_data(std::map& all_instal return true; } -fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic, bool verbose = false); +fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name, int mode, u8 *custom_klic); void package_reader::extract_worker(thread_key thread_data_key) { @@ -947,27 +947,6 @@ void package_reader::extract_worker(thread_key thread_data_key) { bool extract_success = true; - auto read_op = [&](usz pos, usz size) -> std::span - { - if (pos >= entry.file_size) - { - return {}; - } - - // Because that is the length of the buffer at the moment - const u64 block_size = std::min(BUF_SIZE, entry.file_size - pos); - - const std::span data_span = decrypt(entry.file_offset + pos, block_size, is_psp ? PKG_AES_KEY2 : m_dec_key.data(), thread_data_key); - - if (data_span.size() != block_size) - { - extract_success = false; - pkg_log.error("Failed to extract file %s (data_span.size=%d, block_size=%d)", path, data_span.size(), block_size); - } - - return data_span; - }; - struct pkg_file_reader : fs::file_base { const std::function m_read_func; @@ -1128,7 +1107,7 @@ void package_reader::extract_worker(thread_key thread_data_key) if (is_buffered) { - final_data = DecryptEDAT(in_data, name, 1, reinterpret_cast(&m_header.klicensee), true); + final_data = DecryptEDAT(in_data, name, 1, reinterpret_cast(&m_header.klicensee)); } else { diff --git a/rpcs3/Emu/system_utils.cpp b/rpcs3/Emu/system_utils.cpp index 448addc4a5..7c3de4b4bd 100644 --- a/rpcs3/Emu/system_utils.cpp +++ b/rpcs3/Emu/system_utils.cpp @@ -200,7 +200,7 @@ namespace rpcs3::utils } // Decrypt EDAT and verify its contents - fs::file dec_file = DecryptEDAT(enc_file, edat_path, 8, reinterpret_cast(&k_licensee), false); + fs::file dec_file = DecryptEDAT(enc_file, edat_path, 8, reinterpret_cast(&k_licensee)); if (!dec_file) { sys_log.error("verify_c00_unlock_edat(): Failed to decrypt '%s'", edat_path);