10-24-2013, 07:49 PM
(10-22-2013, 10:32 AM)popsdeco Wrote: https://github.com/cielavenir/psp-saveda...77bd4e5142
[Edit] Seems I have corrupted my files. My success result was false positive...
[Edit2] Although this soft isn't working yet,
} else if (ctx.mode == 0x3) { // Encryption mode 0x3: XOR with SD keys, encrypt with KIRK CMD4 and XOR with the given key.
for (int i = 0; i < 0x10; i++) {
header[0x14 + 0xC + i] = (byte) (header[0x14 + 0xC + i] ^ KeyVault.sdHashKey3[i]);
}
ScrambleSD(header, 0x10, 0xE, 0x4, 0x04);
for (int i = 0; i < 0x10; i++) {
header[0xC + i] = (byte) (0xC + header[i] ^ KeyVault.sdHashKey4[i]);
}
is the 0xC + header[i] correct? I think it should be header[0xC + i]
[Edit3] Is libkirk broken? For example it lacks cmd5 support...
Indeed, the code in encryption mode 3 should be header[0xC + i].
I believe libkirk didn't implement all the CMDs, mostly because they aren't used that often and depend on the PSP's fuseID.
(10-22-2013, 12:38 PM)popsdeco Wrote: Another suspicous code:
if ((ctx.mode == 0x2) || (ctx.mode == 0x4) || (ctx.mode == 0x6)) {
System.arraycopy(resultBuf, 0, scrambleResultBuf, 0x14, 0x10);
ScrambleSD(scrambleResultBuf, 0x10, 0x100, 0x4, 0x05);
ScrambleSD(scrambleResultBuf, 0x10, seed, 0x4, 0x04);
System.arraycopy(scrambleResultBuf, 0, resultBuf, 0, 0x10);
}
I think System.arraycopy(scrambleResultBuf, 0, scrambleResultBuf, 0x14, 0x10); is required, right?
Actually it should be like this:
Code:
if ((ctx.mode == 0x2) || (ctx.mode == 0x4) || (ctx.mode == 0x6)) {
System.arraycopy(resultBuf, 0, scrambleResultBuf, 0x14, 0x10);
ScrambleSD(scrambleResultBuf, 0x10, 0x100, 0x4, 0x05);
System.arraycopy(scrambleResultBuf, 0, scrambleResultBuf, 0x14, 0x10);
for(int i = 0; i < 0x14; i++) {
scrambleResultBuf[i] = 0;
}
ScrambleSD(scrambleResultBuf, 0x10, seed, 0x4, 0x04);
System.arraycopy(scrambleResultBuf, 0, resultBuf, 0, 0x10);
}
But you're right, the 0x14 data on the top of the buffer was indeed missing.
Thank you for finding these mistakes popsdeco, I'm fixing this right away.