Skip to content

Commit

Permalink
fix structs,
Browse files Browse the repository at this point in the history
  • Loading branch information
LiEnby committed Aug 9, 2024
1 parent 3e22e49 commit 5e418bb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions include/psp2/npdrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ int _sceNpDrmGetRifNameForInstall(char *rif_name, const void *rif_data, int unk)
*
* @param[in] license_buf - RIF buffer (1024 bytes)
*
* @param[out] keydata - Decrypted key data
* @param[out] keydata - Decrypted keyset
*
* @param[out] flags - License flags
*
* @param[out] exp_time expire time output, [0] is start_date, [1] is end_date
* @param[out] exp_time - Expire times output
*
* @return 0 on success, < 0 on error
*/
int scePsmDrmGetRifKey(const ScePsmDrmLicense *license_buf, char *keydata, int* flags, SceUInt64 exp_time[2]);
int scePsmDrmGetRifKey(const ScePsmDrmLicense *license_buf, ScePsmDrmKeySet *keydata, int* flags, ScePsmDrmExpireTime* exp_time);

#ifdef __cplusplus
}
Expand Down
30 changes: 21 additions & 9 deletions include/psp2common/npdrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
extern "C" {
#endif

typedef struct ScePsmDrmKeySet {
SceUInt8 hmac_key[0x20];
SceUInt8 key[0x10];
SceUInt8 signature[0x1D0];
} ScePsmDrmKeySet;
VITASDK_BUILD_ASSERT_EQ(0x200, ScePsmDrmKeySet);

typedef struct ScePsmDrmExpireTime { // size is 0x10
SceRtcTick* start_date;
SceRtcTick* end_date;
int pad[2];
} ScePsmDrmExpireTime;
VITASDK_BUILD_ASSERT_EQ(0x10, ScePsmDrmExpireTime);

typedef struct SceNpDrmActivationData { // size is 0x1038
SceInt16 act_type;
SceInt16 version_flag;
Expand All @@ -31,16 +45,16 @@ typedef struct SceNpDrmActivationData { // size is 0x1038
VITASDK_BUILD_ASSERT_EQ(0x1038, SceNpDrmActivationData);

typedef struct SceNpDrmLicense { // size is 0x200
SceInt16 version; // -1 VITA, 0 PSP, 1 PSP-VITA
SceInt16 version; // -1 VITA (NPDRM_FREE), 0 PSP, 1 PSP-VITA
SceInt16 version_flags; // 0, 1
SceInt16 license_type; // 1
SceInt16 license_flags; // 0x400:non-check ecdsa
SceUInt64 account_id;
SceUInt64 account_id; // 0x0:NPDRM_FREE
char content_id[0x30];
char key_table[0x10];
char key1[0x10];
SceInt64 start_time;
SceInt64 expiration_time;
SceRtcTick start_time;
SceRtcTick expiration_time;
char ecdsa_signature[0x28];
SceInt64 flags;
char key2[0x10];
Expand All @@ -62,14 +76,12 @@ typedef struct ScePsmDrmLicense {
SceUInt64 account_id;
SceUInt32 unk3;
SceUInt32 unk4;
SceUInt64 start_time;
SceUInt64 expiration_time;
SceRtcTick start_time;
SceRtcTick expiration_time;
SceUInt8 activation_checksum[0x20];
char content_id[0x30];
SceUInt8 unk5[0x80];
SceUInt8 unk6[0x20];
SceUInt8 key[0x10];
SceUInt8 signature[0x1D0];
ScePsmDrmKeySet keyset;
SceUInt8 rsa_signature[0x100];
} ScePsmDrmLicense;
VITASDK_BUILD_ASSERT_EQ(0x400, ScePsmDrmLicense);
Expand Down

0 comments on commit 5e418bb

Please sign in to comment.