Fix warnings: Remove unused decryption code

This commit is contained in:
Megamouse 2024-02-28 10:26:24 +01:00
parent 75ef154c12
commit 18983f5476
5 changed files with 11 additions and 33 deletions

View File

@ -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<u8*>(&m_klics[key_it]), true);
elf_file = DecryptEDAT(elf_file, old_path, key_it != 0 ? 8 : 1, reinterpret_cast<u8*>(&m_klics[key_it]));
if (!elf_file)
{

View File

@ -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<u8*>(&dec_key), &edatHeader, &npdHeader, &edata_file, false))
{
edat_log.error("NPDRM check_data() failed!");
return false;
}
//if (!check_data(reinterpret_cast<u8*>(&dec_key), &edatHeader, &npdHeader, &edata_file, false))
//{
// edat_log.error("NPDRM check_data() failed!");
// return false;
//}
file_size = edatHeader.file_size;
total_blocks = ::narrow<u32>(utils::aligned_div(edatHeader.file_size, edatHeader.block_size));

View File

@ -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);

View File

@ -862,7 +862,7 @@ bool package_reader::fill_data(std::map<std::string, install_entry*>& 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<const char>
{
if (pos >= entry.file_size)
{
return {};
}
// Because that is the length of the buffer at the moment
const u64 block_size = std::min<u64>(BUF_SIZE, entry.file_size - pos);
const std::span<const char> 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<u64(u64, void*, u64)> 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<u8*>(&m_header.klicensee), true);
final_data = DecryptEDAT(in_data, name, 1, reinterpret_cast<u8*>(&m_header.klicensee));
}
else
{

View File

@ -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<u8*>(&k_licensee), false);
fs::file dec_file = DecryptEDAT(enc_file, edat_path, 8, reinterpret_cast<u8*>(&k_licensee));
if (!dec_file)
{
sys_log.error("verify_c00_unlock_edat(): Failed to decrypt '%s'", edat_path);