summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/loader/loader.h1
-rw-r--r--src/core/loader/ncch.cpp5
-rw-r--r--src/core/loader/ncch.h4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 8de95dacf..a7f2715ba 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -71,6 +71,7 @@ enum class ResultStatus {
ErrorNotUsed,
ErrorAlreadyLoaded,
ErrorMemoryAllocationFailed,
+ ErrorEncrypted,
};
static inline u32 MakeMagic(char a, char b, char c, char d) {
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 094d74100..c67d25b55 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -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;
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index d875e4cf3..fd7c65814 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -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 {