kgsws wrote:I know there is header hash at 0x20, calculated from values: 0x00 - 0x1F and 0x60 - 0x7F.
I know there is data hash at 0x30, calculated from values starting at 0x80. - is this hash of encrypted data or decrypted? (it seems to be compared after decryption)
At 0x00 there is encryption key. - is this key for data decryption?
What is at 0x10? Another part of key? (if it uses AES256)
At 0x70 there is data size.
At 0x74 there is some offset value (in ipl_ms.bin it is 16, in PRX it is 128, in 620ipl it is 512) - what does this exactly do?
Another question is, where encrypted data starts. It has to be at 0x80, but many SCE files contain plaintext before encrypted data - this plaintext is also part of data hash.
I was playing with kirk even before (bruteforce 4*2^32 != 2^128), but there is not too much info about kirk headers.
I am pretty much in the same boat as you are.
The Kirk header seems to end at 0x8F. Starting at 0x90 is a "buffer" of size mentioned at 0x74 which either is skipped or used to form the initial IV.
The first thing Kirk 1 does is to use the hidden key to decrypt 32 bytes (probably the 0x00-0x1F) using decrypt_cbc().
These are my notes:
a0- 49f aes_encrypt_key()
4a0- 5b7 aes_decrypt_key()
5b8- 75f aes_encrypt_cbc? arg0,arg1/block,arg2/block,arg3/flag
760-103f aes_encrypt_??
1040-122c aes_decrypt_??
1230-1ccf aes_decrypt_cbc?
1cd0-1e3f encrypt_cbc(outbuf,inbuf,insize,key,bits,iv) reference by a398(Kirk 4),bdc0(Kirk 1)
1e40-213f decrypt_cbc(outbuf,inbuf,insize,key,bits,iv) reference by afe8(Kirk 7),bdc0(Kirk 1)
2140-24cf encrypt_ctr??
24d0-26df reference by bdc0(Kirk 1) hmac? aes-mac?
26e0-3557 SHA-1 Update??
3558-35cf SHA-1 Init?
35d0-3807 HMAC-SHA1 ??
41f8-4b0f MD5 Update??
4b10-4b7f MD5 Init?
7400-7497 SHA-224 Init
9f00-9f07 return 0x100 (Kirk version?)
9f08-a394 (Kirk Interface)
a398-afe7 Kirk4()
afe8-bdbf Kirk7()
bdc0-d83f Kirk1()
Kirk 4/7 Keys:
0000E670 98 02 C4 E6 EC 9E 9E 2F FC 63 4C E4 2F BB 46 68
0000E680 99 24 4C D2 58 F5 1B CB B0 61 9C A7 38 30 07 5F
0000E690 02 25 D7 BA 63 EC B9 4A 9D 23 76 01 B3 F6 AC 17
0000E6A0 84 85 C8 48 75 08 43 BC 9B 9A EC A7 9C 7F 60 18
0000E6B0 B5 B1 6E DE 23 A9 7B 0E A1 7C DB A2 DC DE C4 6E
0000E6C0 C8 71 FD B3 BC C5 D2 F2 E2 D7 72 9D DF 82 68 82
0000E6D0 0A BB 33 6C 96 D4 CD D8 CB 5F 4B E0 BA DB 9E 03
0000E6E0 32 29 5B D5 EA F7 A3 42 16 C8 8E 48 FF 50 D3 71
0000E6F0 46 F2 5E 8E 4D 2A A5 40 73 0B C4 6E 47 EE 6F 0A
0000E700 5D C7 11 39 D0 19 38 BC 02 7F DD DC B0 83 7D 9D
0000E710 0C FD 67 9A F9 B4 72 4F D7 8D D6 E9 96 42 28 8B
0000E720 AF FE 8E B1 3D D1 7E D8 0A 61 24 1C 95 92 56 B6
0000E730 1C 9B C4 90 E3 06 64 81 FA 59 FD B6 00 BB 28 70
0000E740 03 B3 02 E8 5F F3 81 B1 3B 8D AA 2A 90 FF 5E 61
0000E750 12 46 8D 7E 1C 42 20 9B BA 54 26 83 5E B0 33 03
0000E760 C4 3B B6 D6 53 EE 67 49 3E A9 5F BC 0C ED 6F 8A
0000E770 2C C3 CF 8C 28 78 A5 A6 63 E2 AF 2D 71 5E 86 BA
0000E780 11 5A 5D 20 D5 3A 8D D3 9C C5 AF 41 0F 0F 18 6F
0000E790 9C 9B 13 72 F8 C6 40 CF 1C 62 F5 D5 92 DD B5 82
0000E7A0 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Kirk 1 Key:
0000E7B0 98 C9 40 97 5C 1D 10 E8 7F E6 0E A3 FD 03 A8 BA
0000E800 00 00 1C D0 1cd0: reference by a398:(Kirk 4),bdc0:(Kirk 1) aes_encrypt_cbc ?
0000E810 00 00 1E 40 1e40: reference by afe8:(Kirk 7),bdc0:(Kirk 1) aes_decrypt_cbc ?
0000E820 00 00 24 D0 24d0: reference by bdc0:(Kirk 1) hmac? aes-mac?
GBASP x1, GBM x2, NDSL x2, PSP 100X x3, PSP 200X x6, PSP 300X x5, PSP Go x4, Wii x1