CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hrydgard

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: hrydgard/ppsspp
Path: blob/master/Core/ELF/PrxDecrypter.h
Views: 1401
1
// Copyright (c) 2012- PPSSPP Project.
2
3
// This program is free software: you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation, version 2.0.
6
7
// This program is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
// GNU General Public License 2.0 for more details.
11
12
// A copy of the GPL 2.0 should have been included with the program.
13
// If not, see http://www.gnu.org/licenses/
14
15
// Official git repository and contact information can be found at
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
17
18
#pragma once
19
20
#include "Common/Common.h"
21
#include "Common/CommonTypes.h"
22
23
#ifdef _MSC_VER
24
#pragma pack(push, 1)
25
#endif
26
typedef struct
27
{
28
u32_le signature; // 0
29
u16_le attribute; // 4 modinfo
30
u16_le comp_attribute; // 6
31
u8 module_ver_lo; // 8
32
u8 module_ver_hi; // 9
33
char modname[28]; // 0A
34
u8 version; // 26
35
u8 nsegments; // 27
36
u32_le elf_size; // 28
37
u32_le psp_size; // 2C
38
u32_le entry; // 30
39
u32_le modinfo_offset; // 34
40
s32_le bss_size; // 38
41
u16_le seg_align[4]; // 3C
42
u32_le seg_address[4]; // 44
43
s32_le seg_size[4]; // 54
44
u32_le reserved[5]; // 64
45
u32_le devkitversion; // 78
46
u32_le decrypt_mode; // 7C
47
u8 key_data0[0x30]; // 80
48
s32_le comp_size; // B0
49
s32_le _80; // B4
50
s32_le reserved2[2]; // B8
51
u8 key_data1[0x10]; // C0
52
u32_le tag; // D0
53
u8 scheck[0x58]; // D4
54
u32_le key_data2; // 12C
55
u32_le oe_tag; // 130
56
u8 key_data3[0x1C]; // 134
57
#ifdef _MSC_VER
58
} PSP_Header;
59
#else
60
} __attribute__((packed)) PSP_Header;
61
#endif
62
63
#ifdef _MSC_VER
64
#pragma pack(pop)
65
#endif
66
67
int pspDecryptPRX(const u8 *inbuf, u8 *outbuf, u32 size, const u8 *seed = nullptr);
68
69