Line 1:
Line 1:
β
'''Title metadata''' is a format used to store information about a [[title]] and all its installed contents, including which contents they consist of and their SHA1 hashes.
+
'''Title metadata''' (aka '''TMD''') is a format used to store information about a [[title]] and all its installed contents, including which contents they consist of and their SHA1 hashes.
+
+
TMDs seem to have been originally intended to all be stored in [[:/title/00000001/00000002/data/tmds.sys]], much like ticket.sys on the iQue Player; on release consoles, most TMDs are still stored there, but the TMD files actually used are stored in separate title.tmd files.
== Structure ==
== Structure ==
β
=== Header ===
+
=== Signed blob header ===
{| class="wikitable"
{| class="wikitable"
|- style="background-color: #ddd;"
|- style="background-color: #ddd;"
β
! Start
+
! Absolute offset
! Length
! Length
! Description
! Description
Line 11:
Line 13:
| 0x000
| 0x000
| 4
| 4
β
| Signature type
+
| Signature type (always 0x10001 for RSA-2048 w/ SHA-1)
|-
|-
| 0x004
| 0x004
| 256
| 256
β
| Signature
+
| Signature covering the main header as well as all CMDs
|-
|-
| 0x104
| 0x104
| 60
| 60
| Padding for 64-byte alignment
| Padding for 64-byte alignment
+
|}
+
+
=== Main header ===
+
{| class="wikitable"
+
|- style="background-color: #ddd;"
+
! Absolute offset
+
! Length
+
! Description
|-
|-
| 0x140
| 0x140
| 64
| 64
β
| Issuer
+
| Certificate issuer
|-
|-
| 0x180
| 0x180
Line 43:
Line 53:
| 0x184
| 0x184
| 8
| 8
β
| System Version (the [[IOS]] that the title needs). Set to 0 if this TMD belongs to an IOS. For the boot2 TMD, this is identical to the boot2 version.
+
| System Version (the IOS that the title needs, Set to 0 for IOS itself. For the boot2, this is identical to the boot2 version.)
|-
|-
| 0x18C
| 0x18C
Line 95:
Line 105:
| 0x1E0
| 0x1E0
| 2
| 2
β
| boot index (content index for [[apploader]] [[DOL]])
+
| boot index (content index for boot file. For [[Broadway]] titles, this is typically the [[NAND Boot Program]]. For [[Starlet]] titles, this is the main binary with the kernel/ES/FS, or the single binary for monolithic IOSes)
|-
|-
| 0x1E2
| 0x1E2
| 2
| 2
β
| Unused
+
| Minor version (unused - the term typically refers to the lower half of the main version instead)
β
|-
β
| 0x1E4
β
| 36*nbr_cont
β
| Contents
|}
|}
β
=== Content ===
+
=== Content metadata (CMD) ===
+
Following the main header (starting at offset 0x1E4) is a list of CMDs (one per content).
+
{| class="wikitable"
{| class="wikitable"
|-
|-
β
! Start
+
! Offset
! Length
! Length
! Description
! Description
Line 137:
Line 145:
{| class="wikitable"
{| class="wikitable"
|-
|-
β
! Start
+
! Offset
! Length
! Length
! Description
! Description
Line 155:
Line 163:
| 0x124
| 0x124
| 4
| 4
β
| Tag
+
| Public Key Type
|-
|-
| 0x128
| 0x128
Line 161:
Line 169:
| Name
| Name
|-
|-
β
| 0x168
+
| 0x12C
+
| 4
+
| Date
+
|-
+
| 0x16C
|
|
β
| Key
+
| Public Key
|}
|}
Line 241:
Line 253:
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096
u8 issuer[32];
u8 issuer[32];
β
u32 tag; // identifies what is being signed
+
u32 key_type; // the type of public key
u8 name[64]; // name of thing being signed
u8 name[64]; // name of thing being signed
u8 key[...];
u8 key[...];