Editing PUP
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 16: | Line 16: | ||
The file header for the main PUP file is an SLB2 file. Each PUP fragment packed into it has the following header (note: after the initial 0x10 bytes, the remaining 0x10 bytes are encrypted along with the metadata that follows it). | The file header for the main PUP file is an SLB2 file. Each PUP fragment packed into it has the following header (note: after the initial 0x10 bytes, the remaining 0x10 bytes are encrypted along with the metadata that follows it). | ||
< | <source lang="c"> | ||
struct ScePupHeader { | struct ScePupHeader { | ||
uint32_t magic; // 0x00 - PS4PUPMAGIC "\x4F\x15\x3D\x1D" | uint32_t magic; // 0x00 - PS4PUPMAGIC "\x4F\x15\x3D\x1D" | ||
Line 38: | Line 38: | ||
From this point on, the remaining structures are encrypted in raw update files (though this section can be seen by using the system as an oracle to decrypt PUPs). Following the header is the segment table, which has segment entries that contain information about update entries (a list of which can be found in the "Indices" section). | From this point on, the remaining structures are encrypted in raw update files (though this section can be seen by using the system as an oracle to decrypt PUPs). Following the header is the segment table, which has segment entries that contain information about update entries (a list of which can be found in the "Indices" section). | ||
< | <source lang="c"> | ||
struct ScePupSegmentHeader { | struct ScePupSegmentHeader { | ||
uint64_t flags; // 0x00 | uint64_t flags; // 0x00 | ||
Line 49: | Line 49: | ||
While offset, compressed_size, and uncompressed_size fields are self-explanatory, the flags field packs a lot of information. Below are known flags: | While offset, compressed_size, and uncompressed_size fields are self-explanatory, the flags field packs a lot of information. Below are known flags: | ||
< | <source lang="c"> | ||
#define PUP_SEGMENT_ID(x) (x->flags >> 20) | #define PUP_SEGMENT_ID(x) (x->flags >> 20) | ||
#define PUP_SEGMENT_IS_INFO(x) ((x->flags & (1 << 0)) != 0) | #define PUP_SEGMENT_IS_INFO(x) ((x->flags & (1 << 0)) != 0) | ||
Line 66: | Line 66: | ||
After the segment table is a section that has additional information on the PUP, such as its target firmware and various flags. | After the segment table is a section that has additional information on the PUP, such as its target firmware and various flags. | ||
< | <source lang="c"> | ||
struct ScePupInfo { | struct ScePupInfo { | ||
uint32_t fw_ver; // 0x00 - Firmware version in integer format (ie. FW 9.50 is 0x95080000000) | uint32_t fw_ver; // 0x00 - Firmware version in integer format (ie. FW 9.50 is 0x95080000000) | ||
Line 82: | Line 82: | ||
Following the info structure is the metadata table. These entries contain crypto material such as intermediate keys for decrypting and verifying segments. Each segment should have a metadata table entry. | Following the info structure is the metadata table. These entries contain crypto material such as intermediate keys for decrypting and verifying segments. Each segment should have a metadata table entry. | ||
< | <source lang="c"> | ||
struct ScePupMetadataEntry { | struct ScePupMetadataEntry { | ||
char aes128_key[0x10]; // 0x00 - AES128 data decryption key | char aes128_key[0x10]; // 0x00 - AES128 data decryption key |