Changes

Jump to navigation Jump to search
439 bytes added ,  20:56, 8 September 2018
no edit summary
Line 1: Line 1:  
The DSiWare exported from a 3DS is located at "[[SD_Filesystem|sdmc]]:/Nintendo 3DS/<ID0>/<ID1>/Nintendo DSiWare". Filenames are same format as [http://dsibrew.org/wiki/Tad DSi]: "<TitleID-Low>.bin". The below sizes include the 0x20-byte block metadata.
 
The DSiWare exported from a 3DS is located at "[[SD_Filesystem|sdmc]]:/Nintendo 3DS/<ID0>/<ID1>/Nintendo DSiWare". Filenames are same format as [http://dsibrew.org/wiki/Tad DSi]: "<TitleID-Low>.bin". The below sizes include the 0x20-byte block metadata.
   −
DSiWare exported from 3DS use [[Nand/private/movable.sed|keyslots]] initialized by movable.sed. Each section is encrypted with AES-CBC.
+
DSiWare exported from 3DS use console-unique [[Nand/private/movable.sed|keyslots]] initialized by movable.sed. Each section is encrypted with AES-CBC.
   −
The content sections are ordered the same way as DSi: TMD, SRL from content0, <content1-7 for format v2>, savegame, and banner.sav.(ContentX here is the .app data from TWL-NAND /title)
+
The content sections are ordered the same way as DSi: TMD, SRL from content0, <content1-7 for format v2>, public.sav, and banner.sav when banner.sav exists. When the DSiWare export type is 7-11, the 12th content section is the private.sav, if it exists.(ContentX here is the .app data from TWL-NAND /title)
   −
The DSiWare export type is specified by [[AMPXI:ExportDSiWare]], this field is also used to specify the format version. For NATIVE_FIRM versions where this DSiWare type field is unused, format version v1 is used. When this field is used, format version v1 is used for DSiWare type value 13, otherwise v2 is used. When the DSiWare type is value 12, format version v2 is used, however however the total content sections is 4 instead of 11.
+
=DSiWare Export Types=
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Value
 +
!  Format version
 +
!  Description
 +
|-
 +
| 0-6
 +
|
 +
| Same as value 14.
 +
|-
 +
| 7-11
 +
| v2
 +
| 12 content sections
 +
|-
 +
| 12
 +
| v2
 +
| 4 content sections
 +
|-
 +
| 13
 +
| v1
 +
| 4 content sections
 +
|-
 +
| 14
 +
| v2
 +
| 11 content sections
 +
|}
 +
 
 +
For NATIVE_FIRM versions where this DSiWare export [[AM:ExportDSiWare|type]] field is unused, format version v1 is used with 4 content sections. Otherwise when this field is used, see the above table. [[System Settings]] uses type 1 for [[AM:ExportDSiWare|exporting]] DSiWare, regardless of the System Settings title-version.
    
=Block Metadata=
 
=Block Metadata=
Line 20: Line 48:  
| 0x10
 
| 0x10
 
| 0x10
 
| 0x10
| IV, generated by the RNG.
+
| IV, generated by the [[PSPXI:GenerateRandomBytes|RNG]].
 
|}
 
|}
   −
Each section begins with the payload encrypted data, followed by this block metadata. The hash used for the MAC is calculated over the the cleartext payload, however it's unknown how this hash is calculated. This hash used for generating the MAC is also stored in the footer.
+
Each section begins with the payload encrypted data, followed by this block metadata. The SHA-256 hash used for the MAC is calculated over the cleartext payload. This hash used for generating the MAC is also stored in the footer.
    
=Footer=
 
=Footer=
Line 34: Line 62:  
| 0x0
 
| 0x0
 
| X
 
| X
| SHA-256 hashes over the banner, header, and content sections.
+
| SHA-256 hashes over the banner, header, and content sections. When a content section doesn't exist, the corresponding hash here is uninitialized.
 
|-
 
|-
 
| 0x0 + X
 
| 0x0 + X
 
| 0x3C
 
| 0x3C
| ECDSA signature over the previous data, signed by the AP cert?
+
| ECDSA signature using SHA-256 over the previous hashes, signed by the APCert.
 
|-
 
|-
 
| 0x3C + X
 
| 0x3C + X
 
| 0x180
 
| 0x180
| ECDSA "APXXXXXXXXXXXXXXXX" cert signed by the [[CTCert]], where X is random lowercase ASCII hex data.
+
| ECDSA "APXXXXXXXXXXXXXXXX" cert signed by the below [[CTCert]], where X is [[PSPXI:GenerateRandomBytes|random]] lowercase ASCII hex data.
 
|-
 
|-
 
| 0x1BC + X
 
| 0x1BC + X
Line 54: Line 82:     
These hashes are the same hashes used for generating each section's MAC stored in the metadata block. X = 0x40 + totalcontentsections*0x20.
 
These hashes are the same hashes used for generating each section's MAC stored in the metadata block. X = 0x40 + totalcontentsections*0x20.
 +
 +
The curve sect233r1 is used for all related ECDSA signing operations
    
=File Structure v1=
 
=File Structure v1=
Line 71: Line 101:  
|-
 
|-
 
| 0x40E0
 
| 0x40E0
| 0x340 + X, where X is the total size of the hashes stored in the footer.
+
| 0x340 + 0x20 + X, where X is the total size of the hashes stored in the footer.
 
| Footer section
 
| Footer section
 
|-
 
|-
 
| 0x40E0 + footer_size
 
| 0x40E0 + footer_size
 
|  
 
|  
| Data for the 4 content sections are stored here.
+
| Content sections
 
|}
 
|}
   Line 147: Line 177:  
|-
 
|-
 
| 0x4130
 
| 0x4130
| 0x340 + X, where X is the total size of the hashes stored in the footer.
+
| 0x340 + 0x20 + X, where X is the total size of the hashes stored in the footer.
 
| Footer section
 
| Footer section
 
|-
 
|-
 
| 0x4130 + footer_size
 
| 0x4130 + footer_size
 
|  
 
|  
| Data for the 11 content sections are stored here.
+
| Content sections
 
|}
 
|}
  
11

edits

Navigation menu