SCECAF

Files from coredumps or crash reports are in SCECAF format when encrypted. The file names will be either crash_report.caf or a coredump with a filetype of .spsp2dmp. All data is in little endian format.

SCECAF Container File Structure
Header

Repeating Section Meta Blocks

Repeating Section Hash Blocks

Header Hash

Sections

Sections
Sections are data (normally Gzipped ELF core or CPAD padding) that are encrypted. The encryption is AES 128 in CBC. The IV comes from the Section Meta Header and the key is one of the 4 keys listed in the Keys page for Coredumps. The HMAC is the SCE-Modified HMAC SHA256. The HMAC Key is one of the 3 listed on the Keys page as well. The current theory is which key is specified in the section meta header, though since there are no sample that vary, it is just a guess.

Kernel Coredump Encrypted ELF
On firmwares 2.12 and greater, a SceKernelProcess coredump can be created when a critical error (such as a DABT or PABT) occurs in a syscall or kernel thread. The data is encrypted and compressed prior to being wrapped in the SCECAF container.

Process

 * 1) The exception handler in the kernel calls SMC 0x122 with the arguments (Error type, TTBR0, VBAR, SysRoot VA)
 * 2) TrustZone Configures Pervasive Device and SceGrab device - need why still
 * 3) Reset SceDmac5Reg Device
 * 4) Create a SceCrashDumpHeader at PA 0x58000000 on retail and 0x60000000 on devkit
 * 5) Map SceCrashDumpZero to start of DRAM at PA 0x40000000
 * 6) Configure SceDmac5Reg and loop through all of VRAM at PA 0x20000000 in 0x1000 byte chunks
 * 7) Configure SceDmac5Reg and loop through all of DRAM at PA 0x40200000 in 0x10000 byte chunks
 * 8) Call SMC 0x11A to initial a reboot in requested coredump mode
 * 9) Upon reboot, coredump handler will create a SCECAF container of the data in 0x58000000 or 0x60000000