That "plaintext" before 0x90+value seems to be IV. You can't notice it because in ms_ipl.bin it is all zero. Try it with any PRX, if you start decrypting at 0x90 you will get correct ELF header, but if you start at 0x90+value, first 16 bytes are wrong. It should be simple to compute IV = decrypting plaintext. I am going to test it now.coyotebean wrote:decrypt_cbc 0x00 to 0x1F using Kirk 1 key
decrypt_cbc 0x90+value at 0x74 to end of file using decrypted 0x00-0x0F as key
Also got working header CMAC thanks to your info.
EDIT: ok, it was just bug, forgot to clean IV
EDIT: changing any byte in header make data hash invalid, seems like data hash also checks header
EDIT: got correct data hash ... but only for ms_ipl right now
EDIT: still something strange on kirk, anyway i got matching data hash for uhura.prx (from AR) and 620ipl, but kirk refuses it ...
Data hash calculation is CMAC of kirk header (starting from 0x60) + "plaintext" data (between header and encrypted data) + encrypted data