Revised and working RO patch

This commit is contained in:
TuxSH 2016-05-14 20:26:32 +02:00
parent c32eefaa51
commit afc6f51ff2

View File

@ -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 sha256ChecksPattern2[] = {
0xF8, 0x4F, 0x2D, 0xE9, 0x01, 0x70, 0xA0, 0xE1
};
static const u8 sigCheckPatch[] = {
static const u8 stub[] = {
0x00, 0x00, 0xA0, 0xE3, 0x1E, 0xFF, 0x2F, 0xE1 // mov r0, #0; bx lr
};
static const u8 sha256ChecksPatch[] = {
0x00, 0x00, 0xA0, 0xE3, 0x00, 0x10, 0xF0, 0xE3 // mov r0, #0; mnvs r1, #0
};
//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
//Disable CRO0/CRR0 SHA256 hash checks (section hashes, and hash table)
patchMemory(code, size,
sha256ChecksPattern,
sizeof(sha256ChecksPattern), -4,
sha256ChecksPatch,
sizeof(sigCheckPatch), 1
sha256ChecksPattern1,
sizeof(sha256ChecksPattern1), 0,
stub,
sizeof(stub), 1
);
patchMemory(code, size,
sha256ChecksPattern2,
sizeof(sha256ChecksPattern2), 0,
stub,
sizeof(stub), 1
);
break;