Line 236:
Line 236:
"'''<ContentID>.cmd'''" - (The Content ID is a u32, initially: '''00000001''' when the title is first installed. Changing by an increment of +'''0x1''' for each time the 3DS adds/removes '.app' files) This file contains data taken from the title's [[TMD]]. See the below table for the format of the cleartext .cmd file. The [[Title Database|Title.db]] contains the Content ID for the '.cmd' file, but does not contain a hash of the '.cmd' file. In addition it is also encrypted with a console-unique [[AES|keyslot]]. This acts as part of the DRM for installed titles, along with the [[Title Database|title.db]].
"'''<ContentID>.cmd'''" - (The Content ID is a u32, initially: '''00000001''' when the title is first installed. Changing by an increment of +'''0x1''' for each time the 3DS adds/removes '.app' files) This file contains data taken from the title's [[TMD]]. See the below table for the format of the cleartext .cmd file. The [[Title Database|Title.db]] contains the Content ID for the '.cmd' file, but does not contain a hash of the '.cmd' file. In addition it is also encrypted with a console-unique [[AES|keyslot]]. This acts as part of the DRM for installed titles, along with the [[Title Database|title.db]].
β
The below AES-MACs(including the last 0x10-bytes of the header) are only used for SD titles, and for NAND [[Title_list|download-play]] titles. For other titles, these MACs are set to all-zero.
+
The below AES-CMACs(including the last 0x10-bytes of the header) are only used for SD titles, for NAND [[Title_list|download-play]] titles, and non-system DSiWare titles. For other titles, these MACs are set to all-zero.
{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 250:
Line 250:
| 0x4
| 0x4
| 0x4
| 0x4
β
| Number of entries? Usually the same as the following u32.
+
| Number of AES-CMACs and Content IDs in the first list. The method to determine this is explained below.
|-
|-
| 0x8
| 0x8
| 0x4
| 0x4
β
| Number of AESMACs? Usually the same as the preceding u32.
+
| Number of Content IDs in the second list
|-
|-
| 0xC
| 0xC
Line 262:
Line 262:
| 0x10
| 0x10
| 0x10
| 0x10
β
| AESMAC over contents?
+
| AES-CMAC over first 0x10
|-
|-
| 0x20
| 0x20
β
| 0x4*(No. of entries)
+
| 0x4 * (No. of entries)
β
| List of contentIDs in (usually) descending order
+
| List of installed Content IDs in order of Content Index, with missing contents replaced with 0xFFFFFFFF
|-
|-
β
| 0x20 + 0x4*(No. of entries)
+
| 0x20 + 0x4 * (No. of entries)
β
| 0x4*(No. of entries)
+
| 0x4 * (No. of entries)
β
| List of contentIDs in (usually) ascending order
+
| List of installed Content IDs in order of ID name
|-
|-
β
| 0x20+0x8*(No. of entries)
+
| 0x20 + 0x8 * (No. of entries)
β
| 0x10*(No. of entries)
+
| 0x10 * (No. of entries)
β
| These are AESMACs, one for each content.
+
| AES-CMACs for each content in the first list, generated using the process below
|}
|}
β
Entries format:
+
The number of AES-CMACs depends on the highest Content Index installed. For example, a title with 5 contents, but only 1 and 3 are installed, will still result in 3 AES-CMACs, with the 2nd one being unused.
β
{| class="wikitable" border="1"
+
β
|-
+
For SD contents, each AES-CMAC is generated by combining the NCCH header without the signature (0x100-0x1FF), the Content Index and Content ID at the end, both as u32. Then calculate the SHA256 of the data and generate the AES-CMAC using the [[AES Registers#Keyslots|SD/NAND AES-CMAC key]].
β
! Start
+
β
! Size
+
For TWLNAND contents, the process is currently unknown.
β
! Description
+
β
|-
β
| 0x0
β
| 0x4
β
| ContentID
β
|-
β
| 0x4
β
| 0x8
β
| Unknown
β
|}
'''"00000001.sav"''' - This is the title's encrypted [[Savegames|savegame]]. Renaming these savegames causes home-menu to hang while launching titles, modifying these saves results in the same corruption errors as other savegames.
'''"00000001.sav"''' - This is the title's encrypted [[Savegames|savegame]]. Renaming these savegames causes home-menu to hang while launching titles, modifying these saves results in the same corruption errors as other savegames.