From 2fe84d399167d38c7fc5f7f65271dd21b7b10832 Mon Sep 17 00:00:00 2001 From: devnoname120 Date: Mon, 7 Nov 2016 01:10:41 +0100 Subject: Add NpDrmPackage Reversed and documented by @173210. See http://173210.github.io/scenpdrmpackage --- include/user/npdrmpackage.h | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/user/npdrmpackage.h (limited to 'include/user/npdrmpackage.h') diff --git a/include/user/npdrmpackage.h b/include/user/npdrmpackage.h new file mode 100644 index 0000000..dc01421 --- /dev/null +++ b/include/user/npdrmpackage.h @@ -0,0 +1,47 @@ +#ifndef _PSP2_NPDRMPACKAGE_H_ +#define _PSP2_NPDRMPACKAGE_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Options for _sceNpDrmPackageDecrypt */ +typedef struct { + /** The offset in the encrypted data */ + SceOff offset; + + /** + * The identifier specified for _sceNpDrmPackageCheck but NOT ORed + * with (1 << 8) + */ + unsigned int identifier; +} _sceNpDrmPackageDecrypt_opt; + +/** + * Read the header of the PKG and initialize the context + * + * @param buffer - The buffer containing the header of PKG. + * @param size - The size of buffer. The minimum confirmed value is 0x8000. + * @param zero - Unknown. Supposed to be set to 0. + * @param identifier - arbitrary value [0, 6) ORed with (1 << 8) or 0. + * If it is set to 0, the function just checks the header + * and doesn't create the context. + */ +int _sceNpDrmPackageCheck(const void *buffer, SceSize size, int zero, unsigned int identifier); + +/** + * Decrypt a PKG + * + * @param buffer - The buffer containing the content of the PKG. + * @param size - The size of the buffer. The minimum confirmed value is 0x20. + * @param opt - The options. + */ +int _sceNpDrmPackageDecrypt(void * restrict buffer, SceSize size, _sceNpDrmPackageDecrypt_opt * restrict opt); + +#ifdef __cplusplus +} +#endif + +#endif /* _PSP2_NPDRMPACKAGE_H_ */ -- cgit v1.2.3 From 7eb82cf2a408e23cebf38178da9735716adc7d09 Mon Sep 17 00:00:00 2001 From: devnoname120 Date: Sat, 12 Nov 2016 02:51:06 +0100 Subject: Add return value of sceNpDrmPackage functions --- include/user/npdrmpackage.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/user/npdrmpackage.h') diff --git a/include/user/npdrmpackage.h b/include/user/npdrmpackage.h index dc01421..5a41475 100644 --- a/include/user/npdrmpackage.h +++ b/include/user/npdrmpackage.h @@ -28,6 +28,8 @@ typedef struct { * @param identifier - arbitrary value [0, 6) ORed with (1 << 8) or 0. * If it is set to 0, the function just checks the header * and doesn't create the context. + * + * @return 0 on success, != 0 on error */ int _sceNpDrmPackageCheck(const void *buffer, SceSize size, int zero, unsigned int identifier); @@ -37,6 +39,8 @@ int _sceNpDrmPackageCheck(const void *buffer, SceSize size, int zero, unsigned i * @param buffer - The buffer containing the content of the PKG. * @param size - The size of the buffer. The minimum confirmed value is 0x20. * @param opt - The options. + * + * @return 0 on success, != 0 on error */ int _sceNpDrmPackageDecrypt(void * restrict buffer, SceSize size, _sceNpDrmPackageDecrypt_opt * restrict opt); -- cgit v1.2.3