Changes

Jump to navigation Jump to search
4,077 bytes added ,  14:08, 2 September 2013
no edit summary
Line 18: Line 18:  
The base CTR is fixed therefore the CTR never changes after each write. Thus it is possible to obtain some cleartext by XORing one file(like newly created extdata) with a newer file, where the newer file overwrote zeros in the original file with non-zero data.
 
The base CTR is fixed therefore the CTR never changes after each write. Thus it is possible to obtain some cleartext by XORing one file(like newly created extdata) with a newer file, where the newer file overwrote zeros in the original file with non-zero data.
   −
=== Filesystem ===
+
=== Format ===
 +
 
 +
Extdata uses dual 'partitions' of IVFC hash trees to store data. The order of data in Extdata is as follows:
 +
 
 +
* AES MAC
 +
* DIFF Header
 +
* Secondary DIFI Partition descriptor
 +
* Primary DIFI Partition descriptor
 +
* Secondary Partition IVFC Hash Tree
 +
* Primary Partition IVFC Hash Tree
 +
 
 +
Only one Partition is active at a given time, this is determined by the DIFF header. Normally the 'data' contained in extdata is stored at level4 of the IVFC hash tree, and hence there are two versions of the 'data' stored in the Extdata image (although only one is 'active'). However if DIFI flags[0] is set, this indicates it is a DATA partition and the 'data' is stored outside the IVFC hash tree, at a relative offset defined by the DIFI partition (in this case there will be only one version of the 'data' stored in the Extdata image).
 +
 
 +
==== Chain Of Trust ====
   −
Title extdata contains a series of extdata images which comprise an independent file system. The first image (00000001) contains the VSXE (FST) partition, and subsequent images each containing a single file. Non-title extdata, usually contain single files, or a [[Title Database|database]].
+
The chain of trust in extdata is as follows:
Quota.dat is an extdata image, however it's unknown what this is used for.
     −
'''QUOT'''
+
* MAC verifies DIFF Header
 +
* DIFF Selects and verifies via Active DIFI partition descriptor
 +
* Active DIFI partition descriptor points to the location of active IVFC tree (and data if applicable), and provides the hash blob to verify Level 1 of the IVFC hash tree
 +
* Each IVFC level verifies the next level, until Level 4(data).
   −
* This is contained in the Quota.dat extdata image.
+
=== Filesystem ===
 +
 
 +
Title extdata contains a series of extdata images which comprise an independent file system. The first image (00000001) contains the VSXE (FST) partition, and subsequent images each containing a single file. Other extdata images, such as Quota.dat and [[Title Database|database extdata]], exist independent of a FS.
    +
==== VSXE ====
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 35: Line 53:  
| 0x0
 
| 0x0
 
| 4
 
| 4
| Magic ("QUOT")
+
| Database Magic ("VSXE")
 
|-
 
|-
 
| 0x4
 
| 0x4
Line 43: Line 61:  
| 0x8
 
| 0x8
 
| 8
 
| 8
 +
| Data Table Offset
 +
|-
 +
| 0x10
 +
| 8
 +
| File Size, divided by the value at 0x18
 +
|-
 +
| 0x18
 +
| 8
 +
| Usually 0x1000
 +
|-
 +
| 0x20
 +
| 8
 +
| Unknown
 +
|-
 +
| 0x28
 +
| 4
 +
| 'Action' made on most recently mounted Extdata image
 +
|-
 +
| 0x2C
 +
| 4
 +
| Unknown
 +
|-
 +
| 0x30
 +
| 4
 +
| ID of most recently mounted Extdata image
 +
|-
 +
| 0x34
 +
| 4
 
| Unknown
 
| Unknown
 
|-
 
|-
 +
| 0x38
 +
| 0x100
 +
| Mount path, from most recently mounted Extdata image
 +
|}
 +
 +
Data Table:
 +
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x38
 +
| Unknown
 +
|-
 +
| 0x38
 +
| 8
 +
| Folder Table Offset
 +
|}
 +
 +
===== Folder Table =====
 +
 +
Header:
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Equivalent to the Used Folder Entries + 1;
 +
|-
 +
| 0x4
 +
| 4
 +
| Equivalent to the Maximum Folder Entries + 1;
 +
|-
 +
| 0x8
 +
| 0x20
 +
| Unused
 +
|}
 +
 +
Folder Entry:
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Parent Folder Index;
 +
|-
 +
| 0x4
 
| 0x10
 
| 0x10
| 0x38
+
| Folder Name;
 +
|-
 +
| 0x14
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x18
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x1C
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x20
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x2C
 +
| 0x4
 +
| Unknown
 +
|}
 +
* The folder id/index for the current entry is related to it's position in the Folder table. The folder table is accessed like an array of 0x28 byte chunks, with the header consuming index = 0, root directory at index = 1, and the subsequent folder entries following.
 +
 
 +
===== File Table =====
 +
 
 +
The location of the File table is calculated by aligning the end offset of the folder table to 0x1000 bytes.
 +
 
 +
Header:
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Equivalent to the Used File Entries + 1;
 +
|-
 +
| 0x4
 +
| 4
 +
| Equivalent to the Maximum File Entries + 1;
 +
|-
 +
| 0x8
 +
| 0x28
 +
| Unused
 +
|}
 +
 
 +
Folder Entry:
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Parent Folder Index;
 +
|-
 +
| 0x4
 +
| 0x10
 +
| File Name;
 +
|-
 +
| 0x14
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x18
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x1C
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x20
 +
| 0x8
 +
| Unique Extdata ID
 +
|-
 +
| 0x28
 +
| 0x4
 +
| Unknown
 +
|-
 +
| 0x2C
 +
| 0x4
 
| Unknown
 
| Unknown
 
|}
 
|}
 +
* The file id/index for the current entry is related to it's position in the File Table, much like the folder entries in the Folder Table. The file table is accessed like an array of 0x30 byte chunks, with the header consuming index = 0, and the subsequent file entries following. The relationship between the index value of the file entry, and the actual file name of the extdata image that contains it it = index+1. For instance icon (the only file in every extdata), comes right after the header, with an index value of '1', and the icon is stored in extdata image '00000002'.
   −
==== Filesystem structure ====
+
==== VSXE Filesystem structure ====
    
When extdata is created, these are *always* created regardless of whether the title actually uses them.
 
When extdata is created, these are *always* created regardless of whether the title actually uses them.
User extdata and SpotPass extdata use separate [[FS:OpenArchive|mount]] points at /user and /boss. Therefore one mount can't access the other directory, and also can't access /icon.(The title's SpotPass extdata can be mounted by the title itself, if it uses SpotPass)
      
* /icon This file contains the extdata [[SMDH|icon]] displayed in data management. This icon can only be written to by titles when creating extdata, titles would have to recreate extdata to change the icon. This file can't be read directly, instead it is read via [[FS:ReadExtSaveDataIcon]].
 
* /icon This file contains the extdata [[SMDH|icon]] displayed in data management. This icon can only be written to by titles when creating extdata, titles would have to recreate extdata to change the icon. This file can't be read directly, instead it is read via [[FS:ReadExtSaveDataIcon]].
Line 59: Line 245:  
* /boss/ Can contain [[SpotPass]] content. SpotPass content can only be downloaded to this /boss directory.
 
* /boss/ Can contain [[SpotPass]] content. SpotPass content can only be downloaded to this /boss directory.
    +
User extdata and SpotPass extdata use separate [[FS:OpenArchive|mount]] points at /user and /boss. Therefore one mount can't access the other directory, and also can't access /icon.(The title's SpotPass extdata can be mounted by the title itself, if it uses SpotPass)
 +
 +
 +
Other optional but notable directories include:
 
* /user/ExBanner This directory can optionally store [[Extended_Banner| extended banners]]. When this is available, this banner is displayed instead of the [[CXI]] ExeFS banner. COMMON.bin stores the common exbanner, while <regionlang_code>.bin stores an optional separate region/language specific banner.(regionlang_code can be "JPN_JP", "USA_EN", etc)
 
* /user/ExBanner This directory can optionally store [[Extended_Banner| extended banners]]. When this is available, this banner is displayed instead of the [[CXI]] ExeFS banner. COMMON.bin stores the common exbanner, while <regionlang_code>.bin stores an optional separate region/language specific banner.(regionlang_code can be "JPN_JP", "USA_EN", etc)
 +
 +
=== Extdata without an independent FS ===
 +
 +
==== Quota.dat ====
 +
 +
* This is contained in the Quota.dat extdata image.
 +
 +
{| class="wikitable"
 +
|-
 +
! Start
 +
! Length
 +
! Description
 +
|-
 +
| 0x0
 +
| 4
 +
| Magic ("QUOT")
 +
|-
 +
| 0x4
 +
| 4
 +
| Magic Number (0x30000)
 +
|-
 +
| 0x8
 +
| 8
 +
| Unknown
 +
|-
 +
| 0x10
 +
| 0x38
 +
| Unknown
 +
|}
 +
It's unknown what this is used for.
 +
 +
==== Database Extdata ====
 +
 +
See [[Title Database|here]].
    
=== SD Extdata ===
 
=== SD Extdata ===
Line 221: Line 445:  
=== Tools ===
 
=== Tools ===
   −
* [https://github.com/ps3hen/ctr_toolkit/tree/master/extdata_tool extdata_tool] - Extract standalone extdata images, aswell as title extdata FS.
+
* [https://github.com/ps3hen/ctr_toolkit/tree/master/extdata_tool extdata_tool] - Extract/verifies standalone extdata images and title extdata FS.
839

edits

Navigation menu