mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Fix warnings: Remove unused decryption code
This commit is contained in:
parent
75ef154c12
commit
18983f5476
@ -106,7 +106,7 @@ usz decrypt_binaries_t::decrypt(std::string klic_input)
|
|||||||
case "NPD\0"_u32:
|
case "NPD\0"_u32:
|
||||||
{
|
{
|
||||||
// EDAT / SDAT
|
// 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)
|
if (!elf_file)
|
||||||
{
|
{
|
||||||
|
@ -718,7 +718,7 @@ bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decrypts full file
|
// 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)
|
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
|
// 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
|
// like it slows down load time by a factor of x20, at least, so its ignored for now
|
||||||
|
//if (!check_data(reinterpret_cast<u8*>(&dec_key), &edatHeader, &npdHeader, &edata_file, false))
|
||||||
if (false && !check_data(reinterpret_cast<u8*>(&dec_key), &edatHeader, &npdHeader, &edata_file, false))
|
//{
|
||||||
{
|
// edat_log.error("NPDRM check_data() failed!");
|
||||||
edat_log.error("NPDRM check_data() failed!");
|
// return false;
|
||||||
return false;
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
file_size = edatHeader.file_size;
|
file_size = edatHeader.file_size;
|
||||||
total_blocks = ::narrow<u32>(utils::aligned_div(edatHeader.file_size, edatHeader.block_size));
|
total_blocks = ::narrow<u32>(utils::aligned_div(edatHeader.file_size, edatHeader.block_size));
|
||||||
|
@ -62,7 +62,7 @@ struct EDAT_HEADER
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Decrypts full file, or null/empty file
|
// 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 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);
|
extern bool VerifyEDATHeaderWithKLicense(const fs::file& input, const std::string& input_file_name, const u8* custom_klic, NPD_HEADER *npd_out = nullptr);
|
||||||
|
@ -862,7 +862,7 @@ bool package_reader::fill_data(std::map<std::string, install_entry*>& all_instal
|
|||||||
return true;
|
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)
|
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;
|
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
|
struct pkg_file_reader : fs::file_base
|
||||||
{
|
{
|
||||||
const std::function<u64(u64, void*, u64)> m_read_func;
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -200,7 +200,7 @@ namespace rpcs3::utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decrypt EDAT and verify its contents
|
// 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)
|
if (!dec_file)
|
||||||
{
|
{
|
||||||
sys_log.error("verify_c00_unlock_edat(): Failed to decrypt '%s'", edat_path);
|
sys_log.error("verify_c00_unlock_edat(): Failed to decrypt '%s'", edat_path);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user