Skip to content

Commit

Permalink
Put .SHA NAND dump verification first / Fix H&S injection
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowtrance committed Jun 7, 2016
1 parent 5f9e490 commit 8032142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions source/decryptor/nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ static u32 CheckNandDumpIntegrity(const char* path, bool check_firm) {
u8 header[0x200];
u32 nand_hdr_type = NAND_HDR_UNK;

Debug("Verifying dump via .SHA...");
u32 hash_res = HashVerifyFile(path);
if (hash_res == HASH_FAILED) {
Debug("Failed, file is corrupt!");
return 1;
}
Debug((hash_res == HASH_VERIFIED) ? "Verification passed" : ".SHA not found, skipped");

if (!DebugFileOpen(path))
return 1;

Expand Down Expand Up @@ -382,14 +390,6 @@ static u32 CheckNandDumpIntegrity(const char* path, bool check_firm) {

FileClose();

Debug("Verifying dump via .SHA...");
u32 hash_res = HashVerifyFile(path);
if (hash_res == HASH_FAILED) {
Debug("Failed, file is corrupt!");
return 1;
}
Debug((hash_res == HASH_VERIFIED) ? "Verification passed" : ".SHA not found, skipped");


return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion source/decryptor/nandfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ u32 InjectHealthAndSafety(u32 param)
return 1;

Debug("Injecting H&S app...");
if (EncryptFileToNand("hs.enc", offset_app[0], size_app[0], ctrnand_info) != 0)
if (EncryptFileToNand("hs.enc", offset_app[0], size_hs, ctrnand_info) != 0)
return 1;

Debug("Fixing TMD...");
Expand Down

0 comments on commit 8032142

Please sign in to comment.