Editing PUP

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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).


<syntaxhighlight lang="c">
<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).


<syntaxhighlight lang="c">
<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:


<syntaxhighlight lang="c">
<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.


<syntaxhighlight lang="c">
<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.


<syntaxhighlight lang="c">
<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
Please note that all contributions to PS4 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS4 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)