forked from SciresM/hactool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.h
107 lines (96 loc) · 3.45 KB
/
settings.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef HACTOOL_SETTINGS_H
#define HACTOOL_SETTINGS_H
#include <stdio.h>
#include "types.h"
#include "filepath.h"
typedef enum {
KEYSET_DEV,
KEYSET_RETAIL
} keyset_variant_t;
typedef enum {
BASEFILE_ROMFS,
BASEFILE_NCA,
BASEFILE_FAKE
} hactool_basefile_t;
typedef struct {
unsigned char master_keys[0x20][0x10]; /* Firmware master keys. */
unsigned char package1_keys[0x20][0x10]; /* Package1 keys. */
unsigned char package2_keys[0x20][0x10]; /* Package2 keys. */
unsigned char package2_key_source[0x10]; /* Seed for Package2 key. */
unsigned char aes_kek_generation_source[0x10]; /* Seed for GenerateAesKek, usecase + generation 0. */
unsigned char aes_key_generation_source[0x10]; /* Seed for GenerateAesKey. */
unsigned char key_area_key_application_source[0x10]; /* Seed for kaek 0. */
unsigned char key_area_key_ocean_source[0x10]; /* Seed for kaek 1. */
unsigned char key_area_key_system_source[0x10]; /* Seed for kaek 2. */
unsigned char titlekek_source[0x10]; /* Seed for titlekeks. */
unsigned char header_kek_source[0x10]; /* Seed for header kek. */
unsigned char encrypted_header_key[0x20]; /* Actual encrypted header key. */
unsigned char header_key[0x20]; /* NCA header key. */
unsigned char titlekeks[0x20][0x10]; /* Title key encryption keys. */
unsigned char key_area_keys[0x20][3][0x10]; /* Key area encryption keys. */
unsigned char nca_hdr_fixed_key_modulus[0x100]; /* NCA header fixed key RSA pubk. */
unsigned char acid_fixed_key_modulus[0x100]; /* ACID fixed key RSA pubk. */
unsigned char package2_fixed_key_modulus[0x100]; /* Package2 Header RSA pubk. */
} nca_keyset_t;
typedef struct {
int enabled;
filepath_t path;
} override_filepath_t;
typedef struct {
nca_keyset_t keyset;
int has_titlekey;
unsigned char titlekey[0x10];
unsigned char dec_titlekey[0x10];
int has_contentkey;
unsigned char contentkey[0x10];
filepath_t section_paths[4];
filepath_t section_dir_paths[4];
override_filepath_t exefs_path;
override_filepath_t exefs_dir_path;
override_filepath_t romfs_path;
override_filepath_t romfs_dir_path;
override_filepath_t out_dir_path;
filepath_t pfs0_dir_path;
filepath_t hfs0_dir_path;
filepath_t pk11_dir_path;
filepath_t pk21_dir_path;
filepath_t ini1_dir_path;
filepath_t dec_nca_path;
filepath_t rootpt_dir_path;
filepath_t update_dir_path;
filepath_t normal_dir_path;
filepath_t secure_dir_path;
filepath_t header_path;
} hactool_settings_t;
enum hactool_file_type
{
FILETYPE_NCA,
FILETYPE_PFS0,
FILETYPE_ROMFS,
FILETYPE_HFS0,
FILETYPE_XCI,
FILETYPE_NPDM,
FILETYPE_PACKAGE1,
FILETYPE_PACKAGE2,
FILETYPE_INI1,
FILETYPE_KIP1
};
#define ACTION_INFO (1<<0)
#define ACTION_EXTRACT (1<<1)
#define ACTION_VERIFY (1<<2)
#define ACTION_RAW (1<<3)
#define ACTION_LISTROMFS (1<<4)
#define ACTION_DEV (1<<5)
#define ACTION_EXTRACTINI1 (1<<6)
#define ACTION_ONLYUPDATEDROMFS (1<<7)
struct nca_ctx; /* This will get re-defined by nca.h. */
typedef struct {
enum hactool_file_type file_type;
FILE *file;
FILE *base_file;
hactool_basefile_t base_file_type;
struct nca_ctx *base_nca_ctx;
hactool_settings_t settings;
uint32_t action;
} hactool_ctx_t;
#endif