diff --git a/source/nand/essentials.h b/source/nand/essentials.h index 3012e78..4edc547 100644 --- a/source/nand/essentials.h +++ b/source/nand/essentials.h @@ -51,6 +51,6 @@ typedef struct { u8 padding_frndseed[0x200 - sizeof(LocalFriendCodeSeed)]; u8 nand_cid[0x10]; u8 padding_nand_cid[0x200 - 0x10]; - u8 otp_hash[0x20]; - u8 padding_otp_hash[0x200 - 0x20]; + u8 otp[0x100]; + u8 padding_otp[0x200 - 0x100]; } __attribute__((packed)) EssentialBackup; diff --git a/source/nand/nandutil.c b/source/nand/nandutil.c index 4d244f0..f7de90f 100644 --- a/source/nand/nandutil.c +++ b/source/nand/nandutil.c @@ -32,7 +32,7 @@ u32 BuildEssentialBackup(const char* path, EssentialBackup* essential) { { "movable" , 0x400, 0x140 }, { "frndseed", 0x600, 0x110 }, { "nand_cid", 0x800, 0x010 }, - { "otp_hash", 0xA00, 0x020 } + { "otp" , 0xA00, 0x100 } }; memset(essential, 0, sizeof(EssentialBackup)); memcpy(essential, filelist, sizeof(filelist)); @@ -69,11 +69,11 @@ u32 BuildEssentialBackup(const char* path, EssentialBackup* essential) { // fill nand cid / otp hash if (GetNandCid(&(essential->nand_cid)) != 0) return 1; - bool have_otp = (GetOtpHash(&(essential->otp_hash)) == 0); - if (!have_otp) memset(&(filelist[5]), 0, sizeof(ExeFsFileHeader)); + if (!IS_UNLOCKED) memset(&(filelist[5]), 0, sizeof(ExeFsFileHeader)); + else memcpy(&(essential->otp), (u8*) 0x10012000, 0x100); // calculate hashes - for (u32 i = 0; i < (have_otp ? 6 : 5); i++) + for (u32 i = 0; i < (IS_UNLOCKED ? 6 : 5); i++) sha_quick(essential->header.hashes[9-i], ((u8*) essential) + files[i].offset + sizeof(ExeFsHeader), files[i].size, SHA256_MODE);