summaryrefslogtreecommitdiff
path: root/include/user/npdrmpackage.h
blob: bcf324dd69d2d5f29179b0c9f8f6e6c0e0a4b1b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
	Vita Development Suite Libraries
*/

#ifndef _PSP2_NPDRMPACKAGE_H_
#define _PSP2_NPDRMPACKAGE_H_

#include <scetypes.h>

#ifdef __cplusplus
extern "C" {
#endif

/** Options for _sceNpDrmPackageDecrypt */
typedef struct _sceNpDrmPackageDecrypt {
	/** 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.
 *
 * @return 0 on success, != 0 on error
 */
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.
 *
 * @return 0 on success, != 0 on error
 */
int _sceNpDrmPackageDecrypt(void * __restrict__ buffer, SceSize size, _sceNpDrmPackageDecrypt_opt * __restrict__ opt);

#ifdef __cplusplus
}
#endif

#endif /* _PSP2_NPDRMPACKAGE_H_ */