Title metadata: Difference between revisions

No edit summary
Neimod (talk | contribs)
No edit summary
Line 43: Line 43:
| 0x1DC||0x2DC||2||Title version
| 0x1DC||0x2DC||2||Title version
|-
|-
| 0x1DE||0x2DE||2||Number of contents
| 0x1DE||0x2DE||2||Number of contents (contcount)
|-
|-
| 0x1E0||0x2E0||64||Content Records
| 0x1E0||0x2E0||2||Boot content
|-
|-
| 0x220||0x320||40||Padding modulo 64
| 0x204||0x204||36*64||Content info records
|-
|-
| 0x248||0x348||4||Boot content
| 0xB04||0xC04||48*contcount|| Content chunk records
|}
 
=== Content info records ===
{| class="wikitable"
|-
|-
| 0x24C||0x34C||4||Banner content
! Start
! Length
! Description
|-
|-
| 0x250||0x350||4||Banner size
| 0x00
| 2
| Content index offset
|-
|-
| 0x254||0x354||32||Hash
| 0x02
| 2
| Content command count
|-
| 0x04
| 32
| SHA-256 hash? Commands?
|}
|}


=== Content Records ===
=== Content chunk records ===
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 67: Line 81:
| 0x00
| 0x00
| 4
| 4
| Content ID
| Content id
|-
|-
| 0x04
| 0x04
| 2
| Content index
|-
| 0x06
| 2
| Content type
|-
| 0x08
| 8
| Content size
|-
| 0x10
| 32
| 32
| SHA-256 Hash
| SHA-256 hash
|}
|}


Line 108: Line 134:
== Example code application ==
== Example code application ==
<source lang="c">
<source lang="c">
typedef struct {
        u32 cid;        // content id
        u8  hash[0x20];  // SHA-256 hash
} content_record;        // size: 0x24 bytes
  enum sig_type {
  enum sig_type {
         RSA_2048_SHA256 = 0x00010004,
         RSA_2048_SHA256 = 0x00010004,
Line 119: Line 140:
         RSA_4096_SHA1  = 0x00010000
         RSA_4096_SHA1  = 0x00010000
  };
  };
typedef struct {
        u32 sig_type;
        u8 sig[*];    // * Signature size
        u8 fill1[60];
        u8 issuer[64]; // Root-CA%08x-CP%08x
        u8 version;
        u8 ca_crl_version;
        u8 signer_crl_version;
        u8 fill2;
        u64 sys_version;
        u64 title_id;
        u32 title_type;
        u16 group_id; // publisher
        u8 reserved[62];
        u32 access_rights;
        u16 title_version;
        u16 num_contents;
        content_record contents[0x40];
        u8 padding[0x28];
        u32 boot_content;
        u32 banner_content;
        u32 banner_size;
        u8 hash[0x20]; /* Huh? */
} tmd;


//The tmd is then followed by a chain of certificates, where each certificate is of the general form
// Sorry I removed the example struct because it is wrong.
typedef struct {
        u32 sig_type;
        u8 sig[*];        // * Signature size
        u8 issuer[64];
        u32 tag;          // identifies what is being signed
        u8 name[64];      // name of thing being signed
        u8 key[...];
} certificate;
</source>
</source>