summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordevnoname1202016-11-07 01:10:41 +0100
committerdevnoname1202016-11-11 04:52:26 +0100
commit2fe84d399167d38c7fc5f7f65271dd21b7b10832 (patch)
tree3c90503daa78948b8a70ff973c74d8eb631896ef
parentFixed power callb (diff)
downloadvds-libraries-2fe84d399167d38c7fc5f7f65271dd21b7b10832.tar.gz
Add NpDrmPackage
Reversed and documented by @173210. See http://173210.github.io/scenpdrmpackage
-rw-r--r--include/user/npdrmpackage.h47
-rw-r--r--nids/360/SceNpDrmPackage.yml9
2 files changed, 56 insertions, 0 deletions
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 <psp2/types.h>
+
+#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_ */
diff --git a/nids/360/SceNpDrmPackage.yml b/nids/360/SceNpDrmPackage.yml
new file mode 100644
index 0000000..e7731fe
--- /dev/null
+++ b/nids/360/SceNpDrmPackage.yml
@@ -0,0 +1,9 @@
+modules:
+ SceNpDrmPackage:
+ nid: 0x00000078
+ libraries:
+ SceNpDrmPackage:
+ nid: 0x88514DB2
+ functions:
+ _sceNpDrmPackageCheck: 0xA1D885FA
+ _sceNpDrmPackageDecrypt: 0xD6F05ACC