DISA and DIFF: Difference between revisions
No edit summary |
TimmSkiller (talk | contribs) |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This page describes DISA and DIFF format as the underlying container of [[Savegames]], [[Extdata]] and [[Title | This page describes DISA and DIFF format as the underlying container of [[Savegames]], [[Extdata]] and [[Title Database]]. For further format specification of the inner data, please refer to their own page. | ||
All data in this page is little-endian. All "unused / padding" fields can contain uninitialized data unless otherwise specified. | All data in this page is little-endian. All "unused / padding" fields can contain uninitialized data unless otherwise specified. | ||
Line 17: | Line 17: | ||
| Gamecard | | Gamecard | ||
| DISA | | DISA | ||
| [[#CTR- | | [[#CTR-NOR0|CTR-NOR0]] | ||
| 0x19 | | 0x19 / 0x33 | ||
|- | |- | ||
| [[Savegames]] | | [[Savegames]] | ||
Line 87: | Line 87: | ||
The data being authenticated by the AES CMAC is a 0x20-byte SHA-256 hash of a data block. The data block has different content formats among CMAC types. All types of data block contain a copy or a hash of the header, which is the start of the the rest of the verification chain, so the AES CMAC effectively authenticates the whole save image. Each type of data block is explained below. | The data being authenticated by the AES CMAC is a 0x20-byte SHA-256 hash of a data block. The data block has different content formats among CMAC types. All types of data block contain a copy or a hash of the header, which is the start of the the rest of the verification chain, so the AES CMAC effectively authenticates the whole save image. Each type of data block is explained below. | ||
=== CTR- | === CTR-NOR0 === | ||
This CMAC type is used for gamecard savegames. It is 0x28-byte long. | This CMAC type is used for gamecard savegames. It is 0x28-byte long. | ||
Line 98: | Line 98: | ||
| 0x00 | | 0x00 | ||
| 8 | | 8 | ||
| Magic "CTR- | | Magic "CTR-NOR0" | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x20 | | 0x20 | ||
| SHA-256 of the following 0x108-byte block | | SHA-256 of the following 0x108-byte block | ||
| | {| class="wikitable" border="1" | ||
! Offset | |||
! Length | |||
! Description | |||
|- | |- | ||
| 0x00 | | 0x00 | ||
| 8 | | 8 | ||
| Magic "CTR- | | Magic "CTR-SAV0" | ||
|- | |- | ||
| 0x08 | | 0x08 | ||
| 0x100 | | 0x100 | ||
| Copy of the DISA header | | Copy of the DISA header | ||
|} | |||
|} | |} | ||
Line 140: | Line 138: | ||
| 0x20 | | 0x20 | ||
| SHA-256 of the following 0x108-byte block | | SHA-256 of the following 0x108-byte block | ||
| | {| class="wikitable" border="1" | ||
! Offset | |||
! Length | |||
! Description | |||
|- | |- | ||
| 0x00 | | 0x00 | ||
Line 156: | Line 151: | ||
| Copy of the DISA header | | Copy of the DISA header | ||
|} | |} | ||
|} | |||
=== CTR-SYS0 === | === CTR-SYS0 === | ||
Line 241: | Line 238: | ||
=== DISA header === | === DISA header === | ||
==== SaveDataSecureValue ==== | |||
{| class="wikitable" border="1" | |||
|- | |||
! Offset !! Length !! Description | |||
|- | |||
| 0x0 || 0x4 || u32, [[Anti_Savegame_Restore|Secure Value]] slot | |||
|- | |||
| 0x4 || 0x8 || u64, [[Anti_Savegame_Restore|Secure Value]] | |||
|} | |||
==== DISA Header structure ==== | |||
{| class="wikitable" border="1" | {| class="wikitable" border="1" | ||
! Offset | ! Offset | ||
Line 311: | Line 319: | ||
|- | |- | ||
| 0x69 | | 0x69 | ||
| | | 1 | ||
| Number of used [[Anti_Savegame_Restore|Save Data Secure Value]] entries in the DISA header | |||
|- | |||
| 0x6A | |||
| 2 | |||
| Padding | | Padding | ||
|- | |- | ||
Line 319: | Line 331: | ||
|- | |- | ||
| 0x8C | | 0x8C | ||
| | | 0x30 (0xC * 0x4) | ||
| [[DISA_and_DIFF#SaveDataSecureValue|Save Data Secure Value]] entries (4) | |||
|- | |||
| 0xBC | |||
| 0x8 | |||
| Unused randomly generated u64 value. | |||
|- | |||
| 0xC4 | |||
| 0x3C | |||
| Unused | | Unused | ||
|} | |} | ||
Line 394: | Line 414: | ||
* DPFS descriptor | * DPFS descriptor | ||
* Partition master hash | * Partition master hash | ||
=== DIFI header === | === DIFI header === | ||
Line 536: | Line 555: | ||
|- | |- | ||
| 0x68 | | 0x68 | ||
| | | 4 | ||
| IVFC level 4 block size in log2 | | IVFC level 4 block size in log2 | ||
|- | |||
| 0x6C | |||
| 4 | |||
| Padding | |||
|- | |- | ||
| 0x70 | | 0x70 | ||
Line 685: | Line 708: | ||
* In the partition table, each descriptor verifies level 1 of its IVFC tree via the master hash. | * In the partition table, each descriptor verifies level 1 of its IVFC tree via the master hash. | ||
* Each IVFC level verifies the next level, until the level 4, which is the inner content. | * Each IVFC level verifies the next level, until the level 4, which is the inner content. | ||
== Summary diagram == | |||
[[File:Disa-diff.png]] |