Skip to content

Commit

Permalink
Revised and working RO patch
Browse files Browse the repository at this point in the history
  • Loading branch information
TuxSH committed May 14, 2016
1 parent c32eefa commit afc6f51
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions injector/source/patcher.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,33 +478,38 @@ void patchCode(u64 progId, u8 *code, u32 size)
static const u8 sigCheckPattern[] = {
0x30, 0x40, 0x2D, 0xE9, 0x02, 0x50, 0xA0, 0xE1
};

static const u8 sha256ChecksPattern[] = {
0x02, 0x11, 0x10, 0xE2, 0x1F, 0x00, 0x00, 0x4A
static const u8 sha256ChecksPattern1[] = {
0x30, 0x40, 0x2D, 0xE9, 0x24, 0xD0, 0x4D, 0xE2
};

static const u8 sigCheckPatch[] = {
0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 // mov r0, #0; bx lr
static const u8 sha256ChecksPattern2[] = {
0xF8, 0x4F, 0x2D, 0xE9, 0x01, 0x70, 0xA0, 0xE1
};

static const u8 sha256ChecksPatch[] = {
0x00, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xF0, 0xE3 // mov r0, #0; mnvs r1, #0
static const u8 stub[] = {
0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 // mov r0, #0; bx lr
};

//Disable CRR0 signature (RSA2048 with SHA256) check
patchMemory(code, size,
sigCheckPattern,
sizeof(sigCheckPattern), 0,
sigCheckPatch,
sizeof(sigCheckPatch), 1
stub,
sizeof(stub), 1
);

//Disable CRO0/CRR0 SHA256 hash checks (section hashes, and hash table)
patchMemory(code, size,
sha256ChecksPattern1,
sizeof(sha256ChecksPattern1), 0,
stub,
sizeof(stub), 1
);

//Disable CRO0/CRR0 SHA256 hash checks
patchMemory(code, size,
sha256ChecksPattern,
sizeof(sha256ChecksPattern), -4,
sha256ChecksPatch,
sizeof(sigCheckPatch), 1
sha256ChecksPattern2,
sizeof(sha256ChecksPattern2), 0,
stub,
sizeof(stub), 1
);

break;
Expand Down

0 comments on commit afc6f51

Please sign in to comment.