yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Loader: Implement encryption check

This commit is contained in:
Gareth Poole 2015-10-10 21:50:10 -04:00
parent d36eeaa3ca
commit 2706394384
3 changed files with 8 additions and 2 deletions

View File

@ -71,6 +71,7 @@ enum class ResultStatus {
ErrorNotUsed,
ErrorAlreadyLoaded,
ErrorMemoryAllocationFailed,
ErrorEncrypted,
};
static inline u32 MakeMagic(char a, char b, char c, char d) {

View File

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

View File

@ -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 {