Editing SELF - SPRX

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 339: Line 339:
=== SCE specific segment types (p_type) ===
=== SCE specific segment types (p_type) ===


<source lang="c">
<source lang="C">
#define PT_SCE_RELA 0x60000000
#define PT_SCE_RELA 0x60000000
#define PT_SCE_LICINFO_1 0x60000001
#define PT_SCE_LICINFO_1 0x60000001
#ddfine PT_SCE_LICINFO_2 0x60000002
#ddfine PT_SCE_LICINFO_2 0x60000002
#define PT_SCE_DYNLIBDATA 0x61000000
#define PT_SCE_DYNLIBDATA 0x61000000
#define PT_SCE_PROCESS_PARAM 0x61000001
#define PT_SCE_PROCPARAM 0x61000001
#define PT_SCE_MODULE_PARAM 0x61000002
#define PT_SCE_UNK_61000010 0x61000010
#define PT_SCE_RELRO 0x61000010 // for PS4
#define PT_SCE_COMMENT 0x6FFFFF00
#define PT_SCE_COMMENT 0x6FFFFF00
#define PT_SCE_LIBVERSION 0x6FFFFF01
#define PT_SCE_LIBVERSION 0x6FFFFF01
Line 356: Line 355:
#define PT_SCE_PPURELA 0x700000A4
#define PT_SCE_PPURELA 0x700000A4
#define PT_SCE_SEGSYM 0x700000A8
#define PT_SCE_SEGSYM 0x700000A8
</source>
'''PT_SCE_MODULE_PARAM (PS4)'''
This segment contains a single C struct. It appears instead of PT_SCE_PROCESS_PARAM if the ELF file was compiled to be a library. Like PT_SCE_PROCESS_PARAM, the .data segment contains it and it is always at offset 0.
<source lang="c">
struct SceModuleParamBase {
    // current size of the struct this version
    uint64_t size;
    // magic bytes
    uint32_t magic; // 0x3c13f4bf
    // current version of the struct format used
    uint32_t version;
    // for example: 0x0803_0001 for firmware version 8.03
    uint32_t sdk_version;
}
</source>
The struct is the base or head of the actual struct used. The above fields are always present and their offsets do not change between versions.
Fields whose name are of the form: unk_0x[0-9 aA-fF], are unknown fields whose offset is in the name, e.g. unk_0x18 is at offset 0x18.<source lang="c">
// checked FW 2.xx-7.00
// FW < 2.00 files do not have a PT_SCE_MODULE_PARAM segment, unchecked 7.00 < FW < 7.55
struct SceModuleParamV1 {
    uint64_t size; // 0x18
    uint32_t magic; // 0x3c13f4bf
    uint32_t version; // 1 for V1
    uint32_t sdk_version;
}
// checked 7.55-9.00, unchecked FW > 10.50 and 7.00 < FW < 7.55
struct SceModuleParamV2 {
    uint64_t size; // 0x20
    uint32_t magic; // 0x3c13f4bf
    uint32_t version; // 2 for V2
    uint32_t sdk_version;
    uint64_t unk_0x18;
}
</source>
</source>


Line 524: Line 488:
   unsigned char s[0x1C];
   unsigned char s[0x1C];
} ECDSA224_signature;
} ECDSA224_signature;
// current hypothesis of SceSharedSecret is full (0x40 bytes) shared_secret overwritten with klicensee at offset 0x10
typedef struct SceSharedSecret { // size is 0x40 on PS Vita SDK versions 0.931.010-3.740.011
  uint8_t shared_secret_0[0x10]; // ex: 0x7E7FD126A7B9614940607EE1BF9DDF5E or full of zeroes
  uint8_t klicensee[0x10]; // usually full of zeroes for NPDRM and fSELF. Usually retrieved from bound RIF for NPDRM.
  uint8_t shared_secret_2[0x10]; // usually full of zeroes for NPDRM and fSELF
  uint32_t shared_secret_3_0; // ex: 0x10, usually full of zeroes for NPDRM and fSELF
  uint32_t shared_secret_3_1; // usually full of zeroes for NPDRM and fSELF
  uint32_t shared_secret_3_2; // usually full of zeroes for NPDRM and fSELF
  uint32_t shared_secret_3_3; // usually full of zeroes for NPDRM and fSELF
} SceSharedSecret;


  typedef struct {
  typedef struct {
Line 576: Line 529:
     struct { // 0x100 bytes of data
     struct { // 0x100 bytes of data
       uint32_t magic;              // 7F 44 52 4D (".DRM")
       uint32_t magic;              // 7F 44 52 4D (".DRM")
       uint32_t finalized_flag;      // ex: 80 00 00 01. It may be version like in NPD.
       uint32_t finalized_flag;      // ex: 80 00 00 01
       uint32_t drm_type;            // [[NPDRM#DRM_Type]]
       uint32_t drm_type;            // [[NPDRM#DRM_Type]] ex: 2 local, 0xD free with license requirement
       uint32_t padding;             // It may be Application Type like in NPD.
       uint32_t padding;
       uint8_t content_id[0x30];
       uint8_t content_id[0x30];
       uint8_t digest[0x10];        // ?sha-1 hash of debug SELF/SPRX created using make_fself_npdrm? content_id hash?
       uint8_t digest[0x10];        // ?sha-1 hash of debug self/sprx created using make_fself_npdrm? content_id hash?
       uint8_t padding_78[0x78];
       uint8_t padding_78[0x78];
       ECDSA224_signature sig[0x38]; // signature of PSVita_npdrm_header? signature of an external NPDRM file?
       ECDSA224_signature sig[0x38]; // signature of PSVita_npdrm_header? signature of an external NPDRM file?
Line 592: Line 545:
     // type 7, 0x50 bytes
     // type 7, 0x50 bytes
     struct { // 0x40 bytes of data
     struct { // 0x40 bytes of data
       SceSharedSecret shared_secret;
       uint8_t shared_secret_0[0x10]; // ex: 0x7E7FD126A7B9614940607EE1BF9DDF5E or full of zeroes
      uint8_t shared_secret_1[0x10]; // ex: full of zeroes
      uint8_t shared_secret_2[0x10]; // ex: full of zeroes
      uint8_t shared_secret_3[0x10]; // ex: full of zeroes
     } PSVita_shared_secret_header;
     } PSVita_shared_secret_header;
   };
   };
Line 609: Line 565:
   uint8[0x14] elf_digest;        /* sha1 hash of the ELF file */
   uint8[0x14] elf_digest;        /* sha1 hash of the ELF file */
   uint32_t    unknown_0;          /* seems to be padding */
   uint32_t    unknown_0;          /* seems to be padding */
   uint64_t    required_system_version;    /* PS3_SYSTEM_VER, decimal format */
   uint64_t    required_system_vesion;    /* PS3_SYSTEM_VER, decimal format */
} supplemental_header_table;
} supplemental_header_table;
</source>
</source>
Line 662: Line 618:




{{File Formats}}<noinclude>
{{File Formats}}<noinclude>[[Category:Main]]</noinclude>
[[Category:Main]]
</noinclude>
Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 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)