CRR0
Jump to navigation
Jump to search
CRR files are used for attestation of 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
| Offset | Size | Description |
|---|---|---|
| 0x00 | 0x04 | Magic "CRR0" |
| 0x04 | 0x04 | Reserved |
| 0x08 | 0x04 | Next loaded CRR (must be zero in file, set by RO during loading) |
| 0x0C | 0x04 | Previous loaded CRR (must be zero in file, set by RO during loading) |
| 0x10 | 0x04 | Debug Info Offset |
| 0x14 | 0x04 | Debug Info Size |
| 0x18 | 0x08 | Reserved |
| 0x20 | 0x04 | UniqueID Mask |
| 0x24 | 0x04 | UniqueID Pattern |
| 0x28 | 0x18 | Reserved |
| 0x40 | 0x100 | RSA-2048 modulo |
| 0x140 | 0x100 | RSA-2048 signature signed by Nintendo, starting at offset 0x20 with size 0x120 |
| 0x240 | 0x100 | RSA-2048 signature verified with the above modulo, over the data starting at 0x340 until hash table end |
| 0x340 | 0x04 | Process UniqueID<<8, from the ProgramID |
| 0x344 | 0x04 | Size of the whole CRR file |
| 0x348 | 0x08 | Reserved |
| 0x350 | 0x04 | Hash table Offset |
| 0x354 | 0x04 | Total hashes in the hash table |
| 0x358 | 0x04 | Offset to the plain region containing text tags, from the process NCCH |
| 0x35C | 0x04 | Size of plain region |
| 0x360 | SHA-256 hash table |
Debug Info
The debug info region starts with an header:
| 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:
| 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:
| 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:
| 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 |
The info structure is passed to svcBreak with reason = LOAD_CRO or UNLOAD_CRO.