CRR0: Difference between revisions

Unknown (talk | contribs)
mNo edit summary
Kynex7510 (talk | contribs)
Debug info
 
Line 1: Line 1:
[[Category:File formats]]
[[Category:File formats]]
CRR files are used for attestation of [[CRO0|relocatable modules]]. Each hash stored in the hash table is over the corresponding module's hash table.
CRR files must be stored under "romfs:/.crr/". The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.
= Structure =


{| class="wikitable" border="1"
{| class="wikitable" border="1"
Line 6: Line 12:
!  Description
!  Description
|-
|-
| 0x0
| 0x00
| 0x4
| 0x04
| Magic "CRR0"
| Magic "CRR0"
|-
|-
| 0x4
| 0x04
| 0x4
| 0x04
| Reserved
| Reserved
|-
|-
| 0x8
| 0x08
| 0x4
| 0x04
| Next loaded CRR (Must be zero in file, set by RO during loading)
| Next loaded CRR (must be zero in file, set by RO during loading)
|-
|-
| 0xC
| 0x0C
| 0x4
| 0x04
| Previous loaded CRR (Must be zero in file, set by RO during loading)
| Previous loaded CRR (must be zero in file, set by RO during loading)
|-
|-
| 0x10
| 0x10
| 0x4
| 0x04
| Debug Info Offset
| Debug Info Offset
|-
|-
| 0x14
| 0x14
| 0x4
| 0x04
| Debug Info Size
| Debug Info Size
|-
|-
| 0x18
| 0x18
| 0x8
| 0x08
| Reserved
| Reserved
|-
|-
| 0x20
| 0x20
| 0x4
| 0x04
| UniqueID Mask
| UniqueID Mask
|-
|-
| 0x24
| 0x24
| 0x4
| 0x04
| UniqueID Pattern
| UniqueID Pattern
|-
|-
Line 56: Line 62:
| 0x240
| 0x240
| 0x100
| 0x100
| RSA-2048 signature verified with the above modulo, over the data starting at 0x340 with the size from 0x358
| RSA-2048 signature verified with the above modulo, over the data starting at 0x340 until hash table end
|-
|-
| 0x340
| 0x340
| 0x4
| 0x04
| Process UniqueID<<8, from the ProgramID
| Process UniqueID<<8, from the ProgramID
|-
|-
| 0x344
| 0x344
| 0x4
| 0x04
| Size of the whole CRR0 file
| Size of the whole CRR file
|-
|-
| 0x348
| 0x348
| 0x8
| 0x08
| Reserved
| Reserved
|-
|-
| 0x350
| 0x350
| 0x4
| 0x04
| Hash-table Offset
| Hash table Offset
|-
|-
| 0x354
| 0x354
| 0x4
| 0x04
| Total hashes in the hash-table
| Total hashes in the hash table
|-
|-
| 0x358
| 0x358
| 0x4
| 0x04
| Offset to the plain region containing text tags, from the process [[NCCH#CXI|NCCH]]
| Offset to the plain region containing text tags, from the process [[NCCH#CXI|NCCH]]
|-
|-
| 0x35C
| 0x35C
| 0x4
| 0x04
| Size of plain region
| Size of plain region
|-
|-
| 0x360
| 0x360
|  
|  
| SHA-256 hash-table
| SHA-256 hash table
|}
 
== Debug Info ==
 
The debug info region starts with an header:
 
{| class="wikitable" border="1"
!  Offset
!  Size
!  Description
|-
| 0x00
| 0x04
| Offset to a list of entries, one for each CRO module
|-
| 0x04
| 0x04
| Total number of entries
|}
 
The entries are ordered following the hash table, and are structured as such:
 
{| class="wikitable" border="1"
!  Offset
!  Size
!  Description
|-
| 0x00
| 0x04
| Offset to a structure encoding the filename/path for a CRO
|-
| 0x04
| 0x04
| Unknown
|}
 
A CRO filename/path is structured as such:
 
{| class="wikitable" border="1"
!  Offset
!  Size
!  Description
|-
| 0x00
| 0x04
| Offset to the filename/path data
|-
| 0x04
| 0x04
| Size (excluding null terminator, if any)
|}
 
These informations are then used for setting up a CRO debug info structure:
 
{| class="wikitable" border="1"
!  Offset
!  Size
!  Description
|-
| 0x00
| 0x04
| Virtual address of the filename/path data
|-
| 0x04
| 0x04
| Size of filename/path + 1
|-
| 0x08
| 0x04
| Mapping address of CRO
|-
| 0x0C
| 0x04
| Mapping address for the .data segment, if any
|}
|}
Each hash stored in the hash-table is over the corresponding executable [[CRO0]] hash-table.


CRR0 files must be stored under "romfs:/.crr/". The end of the file is aligned to a 0x1000-byte boundary with 0xCC bytes.
The info structure is passed to [[SVC|svcBreak]] with reason = LOAD_CRO or UNLOAD_CRO.