mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 12:04:16 +01:00
Loader: Implement encryption check
This commit is contained in:
parent
d36eeaa3ca
commit
2706394384
@ -71,6 +71,7 @@ enum class ResultStatus {
|
||||
ErrorNotUsed,
|
||||
ErrorAlreadyLoaded,
|
||||
ErrorMemoryAllocationFailed,
|
||||
ErrorEncrypted,
|
||||
};
|
||||
|
||||
static inline u32 MakeMagic(char a, char b, char c, char d) {
|
||||
|
@ -266,6 +266,11 @@ ResultStatus AppLoader_NCCH::Load() {
|
||||
LOG_DEBUG(Loader, "Thread priority: 0x%X" , priority);
|
||||
LOG_DEBUG(Loader, "Resource limit category: %d" , resource_limit_category);
|
||||
|
||||
if (exheader_header.arm11_system_local_caps.program_id != ncch_header.program_id) {
|
||||
LOG_ERROR(Loader, "ExHeader Program ID mismatch: the ROM is probably encrypted.");
|
||||
return ResultStatus::ErrorEncrypted;
|
||||
}
|
||||
|
||||
// Read ExeFS...
|
||||
|
||||
exefs_offset = ncch_header.exefs_offset * kBlockSize;
|
||||
|
@ -23,7 +23,7 @@ struct NCCH_Header {
|
||||
u16 maker_code;
|
||||
u16 version;
|
||||
u8 reserved_0[4];
|
||||
u8 program_id[8];
|
||||
u64_le program_id;
|
||||
u8 reserved_1[0x10];
|
||||
u8 logo_region_hash[0x20];
|
||||
u8 product_code[0x10];
|
||||
@ -109,7 +109,7 @@ struct ExHeader_StorageInfo {
|
||||
};
|
||||
|
||||
struct ExHeader_ARM11_SystemLocalCaps {
|
||||
u8 program_id[8];
|
||||
u64_le program_id;
|
||||
u32 core_version;
|
||||
u8 reserved_flags[2];
|
||||
union {
|
||||
|
Loading…
Reference in New Issue
Block a user