This commit is contained in:
Nekotekina 2017-02-16 16:56:51 +03:00
parent 0c8bda4f41
commit 3ecba8e57f
2 changed files with 137 additions and 40 deletions

View file

@ -366,14 +366,16 @@ public:
bool DecryptData();
};
class SELFDecrypter : private SCEDecrypter
class SELFDecrypter
{
// SELF, APP headers.
// Main SELF file stream.
const fs::file& self_f;
// SCE, SELF and APP headers.
SceHeader sce_hdr;
SelfHeader self_hdr;
AppInfo app_info;
bool isElf32;
// ELF64 header and program header/section header arrays.
Elf64_Ehdr elf64_hdr;
std::vector<Elf64_Shdr> shdr64_arr;
@ -389,14 +391,25 @@ class SELFDecrypter : private SCEDecrypter
SCEVersionInfo scev_info;
std::vector<ControlInfo> ctrlinfo_arr;
// Metadata structs.
MetadataInfo meta_info;
MetadataHeader meta_hdr;
std::vector<MetadataSectionHeader> meta_shdr;
// Internal data buffers.
std::unique_ptr<u8[]> data_keys;
u32 data_keys_length;
std::unique_ptr<u8[]> data_buf;
u32 data_buf_length;
// Main key vault instance.
KeyVault key_v;
public:
SELFDecrypter(const fs::file& s, bool isElf32) : SCEDecrypter(s), key_v(), isElf32(isElf32) {};
fs::file MakeFile();
bool LoadHeaders();
void ShowHeaders();
SELFDecrypter(const fs::file& s);
fs::file MakeElf(bool isElf32);
bool LoadHeaders(bool isElf32);
void ShowHeaders(bool isElf32);
bool LoadMetadata();
bool DecryptData();
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);