Line 58:
Line 58:
* to calculate the checksum, a CRC16 of the block (with starting value 0xFFFF) is calculated, and the two bytes of the CRC16 are XORed together to produce the 8bit checksum
* to calculate the checksum, a CRC16 of the block (with starting value 0xFFFF) is calculated, and the two bytes of the CRC16 are XORed together to produce the 8bit checksum
−
=== MAC header ===
+
=== AES MAC header ===
{| class="wikitable"
{| class="wikitable"
Line 68:
Line 68:
| 0x00
| 0x00
| 0x10
| 0x10
−
| [[AES]]-CBC MAC over a 0x20-byte SHA256 hash
+
| [[AES]] MAC over a 0x20-byte SHA256 hash
|-
|-
| 0x10
| 0x10
Line 75:
Line 75:
|}
|}
−
This MAC is used to "sign" the DISA/DIFF header. Each time the savegame is updated the hash stored in the DISA/DIFF is updated, therefore the MAC must be updated each time the save is modified as well. SHA256_Update() is used to calculate the hash with the blocks described below.
+
This AES MAC is used to "sign" the DISA/DIFF header. Each time the savegame is updated the hash stored in the DISA/DIFF is updated, therefore the MAC must be updated each time the save is modified as well. SHA256_Update() is used to calculate the hash with the blocks described below.
==== Savegame Types ====
==== Savegame Types ====
Line 99:
Line 99:
|-
|-
| CTR-9DB0
| CTR-9DB0
−
| ?
+
| /dbs extdata images
|}
|}
Line 196:
Line 196:
|-
|-
| 0x4
| 0x4
−
| ?
+
| ID, value 0x2 for title.db.
|-
|-
| 0x100
| 0x100
Line 202:
Line 202:
|}
|}
−
This is likely used for the [[Title_Database|dbs]] images' MAC.
+
This is used for the [[Title_Database|dbs]] images' MAC.
=== Partitions ===
=== Partitions ===