mirror of
https://github.com/SciresM/hactool
synced 2024-11-10 06:34:14 +00:00
Mark identifiers as internally linked where appropriate
Makes it more obvious which parts are only used within the translation unit, and which functions are part of the exposed interface in the headers (and also has the benefit of allowing better inlining/optimizing)
This commit is contained in:
parent
6c3a6a52f7
commit
29e27ee831
13 changed files with 51 additions and 51 deletions
2
aes.c
2
aes.c
|
@ -113,7 +113,7 @@ void aes_decrypt(aes_ctx_t *ctx, void *dst, const void *src, size_t l) {
|
|||
mbedtls_cipher_finish(&ctx->cipher_dec, NULL, NULL);
|
||||
}
|
||||
|
||||
void get_tweak(unsigned char *tweak, size_t sector) {
|
||||
static void get_tweak(unsigned char *tweak, size_t sector) {
|
||||
for (int i = 0xF; i >= 0; i--) { /* Nintendo LE custom tweak... */
|
||||
tweak[i] = (unsigned char)(sector & 0xFF);
|
||||
sector >>= 8;
|
||||
|
|
|
@ -50,7 +50,7 @@ int os_rmdir(const oschar_t *dir) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void filepath_update(filepath_t *fpath) {
|
||||
static void filepath_update(filepath_t *fpath) {
|
||||
memset(fpath->os_path, 0, MAX_PATH * sizeof(oschar_t));
|
||||
os_strcpy(fpath->os_path, fpath->char_path);
|
||||
}
|
||||
|
|
4
kip.c
4
kip.c
|
@ -129,7 +129,7 @@ char *kip1_get_json(kip1_ctx_t *ctx) {
|
|||
return output_str;
|
||||
}
|
||||
|
||||
void kip1_blz_uncompress(void *hdr_end) {
|
||||
static void kip1_blz_uncompress(void *hdr_end) {
|
||||
uint32_t addl_size = ((uint32_t *)hdr_end)[-1];
|
||||
uint32_t header_size = ((uint32_t *)hdr_end)[-2];
|
||||
uint32_t cmp_and_hdr_size = ((uint32_t *)hdr_end)[-3];
|
||||
|
@ -175,7 +175,7 @@ void kip1_blz_uncompress(void *hdr_end) {
|
|||
}
|
||||
}
|
||||
|
||||
void *kip1_uncompress(kip1_ctx_t *ctx, uint64_t *size) {
|
||||
static void *kip1_uncompress(kip1_ctx_t *ctx, uint64_t *size) {
|
||||
/* Make new header with correct sizes, fixed flags. */
|
||||
kip1_header_t new_header = *ctx->header;
|
||||
for (unsigned int i = 0; i < 3; i++) {
|
||||
|
|
4
nax0.c
4
nax0.c
|
@ -3,7 +3,7 @@
|
|||
#include "sha.h"
|
||||
#include "nax0.h"
|
||||
|
||||
size_t nax0_read(nax0_ctx_t *ctx, uint64_t offset, void *dst, size_t size) {
|
||||
static size_t nax0_read(nax0_ctx_t *ctx, uint64_t offset, void *dst, size_t size) {
|
||||
if (ctx->num_files == 1) {
|
||||
fseeko64(ctx->files[0], offset, SEEK_SET);
|
||||
return fread(dst, 1, size, ctx->files[0]);
|
||||
|
@ -151,7 +151,7 @@ void nax0_save(nax0_ctx_t *ctx) {
|
|||
free(buf);
|
||||
}
|
||||
|
||||
const char *nax0_get_key_summary(unsigned int k) {
|
||||
static const char *nax0_get_key_summary(unsigned int k) {
|
||||
switch (k) {
|
||||
case 0:
|
||||
return "Save";
|
||||
|
|
36
nca.c
36
nca.c
|
@ -14,7 +14,7 @@ void nca_init(nca_ctx_t *ctx) {
|
|||
}
|
||||
|
||||
/* Updates the CTR for an offset. */
|
||||
void nca_update_ctr(unsigned char *ctr, uint64_t ofs) {
|
||||
static void nca_update_ctr(unsigned char *ctr, uint64_t ofs) {
|
||||
ofs >>= 4;
|
||||
for (unsigned int j = 0; j < 0x8; j++) {
|
||||
ctr[0x10-j-1] = (unsigned char)(ofs & 0xFF);
|
||||
|
@ -23,7 +23,7 @@ void nca_update_ctr(unsigned char *ctr, uint64_t ofs) {
|
|||
}
|
||||
|
||||
/* Updates the CTR for a bktr offset. */
|
||||
void nca_update_bktr_ctr(unsigned char *ctr, uint32_t ctr_val, uint64_t ofs) {
|
||||
static void nca_update_bktr_ctr(unsigned char *ctr, uint32_t ctr_val, uint64_t ofs) {
|
||||
ofs >>= 4;
|
||||
for (unsigned int j = 0; j < 0x8; j++) {
|
||||
ctr[0x10-j-1] = (unsigned char)(ofs & 0xFF);
|
||||
|
@ -74,7 +74,7 @@ void nca_section_fseek(nca_section_ctx_t *ctx, uint64_t offset) {
|
|||
}
|
||||
}
|
||||
|
||||
size_t nca_bktr_section_physical_fread(nca_section_ctx_t *ctx, void *buffer, size_t count) {
|
||||
static size_t nca_bktr_section_physical_fread(nca_section_ctx_t *ctx, void *buffer, size_t count) {
|
||||
size_t read = 0; /* XXX */
|
||||
size_t size = 1;
|
||||
char block_buf[0x10];
|
||||
|
@ -311,7 +311,7 @@ void nca_free_section_contexts(nca_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
void nca_save(nca_ctx_t *ctx) {
|
||||
static void nca_save(nca_ctx_t *ctx) {
|
||||
/* Save header. */
|
||||
filepath_t *header_path = &ctx->tool_ctx->settings.header_path;
|
||||
|
||||
|
@ -657,7 +657,7 @@ void nca_decrypt_key_area(nca_ctx_t *ctx) {
|
|||
}
|
||||
|
||||
|
||||
char *nca_get_distribution_type(nca_ctx_t *ctx) {
|
||||
static char *nca_get_distribution_type(nca_ctx_t *ctx) {
|
||||
switch (ctx->header.distribution) {
|
||||
case 0:
|
||||
return "Download";
|
||||
|
@ -668,7 +668,7 @@ char *nca_get_distribution_type(nca_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
char *nca_get_content_type(nca_ctx_t *ctx) {
|
||||
static char *nca_get_content_type(nca_ctx_t *ctx) {
|
||||
switch (ctx->header.content_type) {
|
||||
case 0:
|
||||
return "Program";
|
||||
|
@ -685,7 +685,7 @@ char *nca_get_content_type(nca_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
char *nca_get_encryption_type(nca_ctx_t *ctx) {
|
||||
static char *nca_get_encryption_type(nca_ctx_t *ctx) {
|
||||
if (ctx->has_rights_id) {
|
||||
return "Titlekey crypto";
|
||||
} else {
|
||||
|
@ -693,7 +693,7 @@ char *nca_get_encryption_type(nca_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
void nca_print_key_area(nca_ctx_t *ctx) {
|
||||
static void nca_print_key_area(nca_ctx_t *ctx) {
|
||||
if (ctx->format_version == NCAVERSION_NCA0_BETA) {
|
||||
printf("Key Area (Encrypted):\n");
|
||||
memdump(stdout, "Key (RSA-OAEP Encrypted): ", &ctx->header.encrypted_keys, 0x100);
|
||||
|
@ -727,7 +727,7 @@ void nca_print_key_area(nca_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
char *nca_get_section_type(nca_section_ctx_t *meta) {
|
||||
static char *nca_get_section_type(nca_section_ctx_t *meta) {
|
||||
switch (meta->type) {
|
||||
case PFS0: {
|
||||
if (meta->pfs0_ctx.is_exefs) return "ExeFS";
|
||||
|
@ -743,7 +743,7 @@ char *nca_get_section_type(nca_section_ctx_t *meta) {
|
|||
}
|
||||
|
||||
|
||||
void nca_print_sections(nca_ctx_t *ctx) {
|
||||
static void nca_print_sections(nca_ctx_t *ctx) {
|
||||
printf("Sections:\n");
|
||||
for (unsigned int i = 0; i < 4; i++) {
|
||||
if (ctx->section_contexts[i].is_present) { /* Section exists. */
|
||||
|
@ -839,7 +839,7 @@ void nca_print(nca_ctx_t *ctx) {
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
validity_t nca_section_check_external_hash_table(nca_section_ctx_t *ctx, unsigned char *hash_table, uint64_t data_ofs, uint64_t data_len, uint64_t block_size, int full_block) {
|
||||
static validity_t nca_section_check_external_hash_table(nca_section_ctx_t *ctx, unsigned char *hash_table, uint64_t data_ofs, uint64_t data_len, uint64_t block_size, int full_block) {
|
||||
if (block_size == 0) {
|
||||
/* Block size of 0 is always invalid. */
|
||||
return VALIDITY_INVALID;
|
||||
|
@ -879,7 +879,7 @@ validity_t nca_section_check_external_hash_table(nca_section_ctx_t *ctx, unsigne
|
|||
|
||||
}
|
||||
|
||||
validity_t nca_section_check_hash_table(nca_section_ctx_t *ctx, uint64_t hash_ofs, uint64_t data_ofs, uint64_t data_len, uint64_t block_size, int full_block) {
|
||||
static validity_t nca_section_check_hash_table(nca_section_ctx_t *ctx, uint64_t hash_ofs, uint64_t data_ofs, uint64_t data_len, uint64_t block_size, int full_block) {
|
||||
if (block_size == 0) {
|
||||
/* Block size of 0 is always invalid. */
|
||||
return VALIDITY_INVALID;
|
||||
|
@ -906,7 +906,7 @@ validity_t nca_section_check_hash_table(nca_section_ctx_t *ctx, uint64_t hash_of
|
|||
return result;
|
||||
}
|
||||
|
||||
void nca_save_pfs0_file(nca_section_ctx_t *ctx, uint32_t i, filepath_t *dirpath) {
|
||||
static void nca_save_pfs0_file(nca_section_ctx_t *ctx, uint32_t i, filepath_t *dirpath) {
|
||||
if (i >= ctx->pfs0_ctx.header->num_files) {
|
||||
fprintf(stderr, "Could not save file %"PRId32"!\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -1438,7 +1438,7 @@ void nca_save_pfs0_section(nca_section_ctx_t *ctx) {
|
|||
}
|
||||
|
||||
/* RomFS functions... */
|
||||
int nca_is_romfs_file_updated(nca_section_ctx_t *ctx, uint64_t file_offset, uint64_t file_size) {
|
||||
static int nca_is_romfs_file_updated(nca_section_ctx_t *ctx, uint64_t file_offset, uint64_t file_size) {
|
||||
/* All files in a Base RomFS are "updated". */
|
||||
if (ctx->type == ROMFS) {
|
||||
return 1;
|
||||
|
@ -1459,7 +1459,7 @@ int nca_is_romfs_file_updated(nca_section_ctx_t *ctx, uint64_t file_offset, uint
|
|||
return 0;
|
||||
}
|
||||
|
||||
int nca_visit_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
static int nca_visit_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
romfs_fentry_t *entry;
|
||||
if (ctx->type == ROMFS) {
|
||||
entry = romfs_get_fentry(ctx->romfs_ctx.files, file_offset);
|
||||
|
@ -1506,7 +1506,7 @@ int nca_visit_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, filepath_
|
|||
return found_file;
|
||||
}
|
||||
|
||||
int nca_visit_nca0_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
static int nca_visit_nca0_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
romfs_fentry_t *entry = romfs_get_fentry(ctx->nca0_romfs_ctx.files, file_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
@ -1540,7 +1540,7 @@ int nca_visit_nca0_romfs_file(nca_section_ctx_t *ctx, uint32_t file_offset, file
|
|||
return found_file;
|
||||
}
|
||||
|
||||
int nca_visit_romfs_dir(nca_section_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
static int nca_visit_romfs_dir(nca_section_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
romfs_direntry_t *entry;
|
||||
if (ctx->type == ROMFS) {
|
||||
entry = romfs_get_direntry(ctx->romfs_ctx.directories, dir_offset);
|
||||
|
@ -1585,7 +1585,7 @@ int nca_visit_romfs_dir(nca_section_ctx_t *ctx, uint32_t dir_offset, filepath_t
|
|||
return any_files;
|
||||
}
|
||||
|
||||
int nca_visit_nca0_romfs_dir(nca_section_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
static int nca_visit_nca0_romfs_dir(nca_section_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
romfs_direntry_t *entry = romfs_get_direntry(ctx->nca0_romfs_ctx.directories, dir_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "nca0_romfs.h"
|
||||
|
||||
/* NCA0 RomFS functions... */
|
||||
void nca0_romfs_visit_file(nca0_romfs_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
static void nca0_romfs_visit_file(nca0_romfs_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
romfs_fentry_t *entry = romfs_get_fentry(ctx->files, file_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
@ -32,7 +32,7 @@ void nca0_romfs_visit_file(nca0_romfs_ctx_t *ctx, uint32_t file_offset, filepath
|
|||
}
|
||||
}
|
||||
|
||||
void nca0_romfs_visit_dir(nca0_romfs_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
static void nca0_romfs_visit_dir(nca0_romfs_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
romfs_direntry_t *entry = romfs_get_direntry(ctx->directories, dir_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
|
22
npdm.c
22
npdm.c
|
@ -6,7 +6,7 @@
|
|||
#include "rsa.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
const char *svc_names[0x80] = {
|
||||
static const char * const svc_names[0x80] = {
|
||||
"svcUnknown",
|
||||
"svcSetHeapSize",
|
||||
"svcSetMemoryPermission",
|
||||
|
@ -141,7 +141,7 @@ const char *svc_names[0x80] = {
|
|||
#define MAX_FS_PERM_BOOL 0x1B
|
||||
#define FS_PERM_MASK_NODEBUG 0xBFFFFFFFFFFFFFFFULL
|
||||
|
||||
const fs_perm_t fs_permissions_rw[MAX_FS_PERM_RW] = {
|
||||
static const fs_perm_t fs_permissions_rw[MAX_FS_PERM_RW] = {
|
||||
{"MountContentType2", 0x8000000000000801},
|
||||
{"MountContentType5", 0x8000000000000801},
|
||||
{"MountContentType3", 0x8000000000000801},
|
||||
|
@ -183,7 +183,7 @@ const fs_perm_t fs_permissions_rw[MAX_FS_PERM_RW] = {
|
|||
{"HostAccess", 0xC000000000400000}
|
||||
};
|
||||
|
||||
const fs_perm_t fs_permissions_bool[MAX_FS_PERM_BOOL] = {
|
||||
static const fs_perm_t fs_permissions_bool[MAX_FS_PERM_BOOL] = {
|
||||
{"BisCache", 0x8000000000000080},
|
||||
{"EraseMmc", 0x8000000000000080},
|
||||
{"GameCardCertificate", 0x8000000000000010},
|
||||
|
@ -224,7 +224,7 @@ char *npdm_get_proc_category(int process_category) {
|
|||
}
|
||||
}
|
||||
|
||||
char *kac_get_app_type(uint32_t app_type) {
|
||||
static char *kac_get_app_type(uint32_t app_type) {
|
||||
switch (app_type) {
|
||||
case 0:
|
||||
return "System Module";
|
||||
|
@ -237,7 +237,7 @@ char *kac_get_app_type(uint32_t app_type) {
|
|||
}
|
||||
}
|
||||
|
||||
void kac_add_mmio(kac_t *kac, kac_mmio_t *mmio) {
|
||||
static void kac_add_mmio(kac_t *kac, kac_mmio_t *mmio) {
|
||||
/* Perform an ordered insertion. */
|
||||
if (kac->mmio == NULL || mmio->address < kac->mmio->address) {
|
||||
mmio->next = kac->mmio;
|
||||
|
@ -450,7 +450,7 @@ void kac_print(uint32_t *descriptors, uint32_t num_descriptors) {
|
|||
}
|
||||
|
||||
/* Modified from https://stackoverflow.com/questions/23457305/compare-strings-with-wildcard */
|
||||
int match(const char *pattern, const char *candidate, int p, int c) {
|
||||
static int match(const char *pattern, const char *candidate, int p, int c) {
|
||||
if (pattern[p] == '\0') {
|
||||
return candidate[c] == '\0';
|
||||
} else if (pattern[p] == '*') {
|
||||
|
@ -464,7 +464,7 @@ int match(const char *pattern, const char *candidate, int p, int c) {
|
|||
}
|
||||
}
|
||||
|
||||
int sac_matches(sac_entry_t *lst, char *service) {
|
||||
static int sac_matches(sac_entry_t *lst, char *service) {
|
||||
sac_entry_t *cur = lst;
|
||||
while (cur != NULL) {
|
||||
if (match(cur->service, service, 0, 0)) return 1;
|
||||
|
@ -473,7 +473,7 @@ int sac_matches(sac_entry_t *lst, char *service) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void sac_parse(char *sac, uint32_t sac_size, sac_entry_t *r_host, sac_entry_t *r_accesses, sac_entry_t **out_hosts, sac_entry_t **out_accesses) {
|
||||
static void sac_parse(char *sac, uint32_t sac_size, sac_entry_t *r_host, sac_entry_t *r_accesses, sac_entry_t **out_hosts, sac_entry_t **out_accesses) {
|
||||
sac_entry_t *accesses = NULL;
|
||||
sac_entry_t *hosts = NULL;
|
||||
sac_entry_t *cur_entry = NULL;
|
||||
|
@ -513,7 +513,7 @@ void sac_parse(char *sac, uint32_t sac_size, sac_entry_t *r_host, sac_entry_t *r
|
|||
*out_accesses = accesses;
|
||||
}
|
||||
|
||||
void sac_print(char *acid_sac, uint32_t acid_size, char *aci0_sac, uint32_t aci0_size) {
|
||||
static void sac_print(char *acid_sac, uint32_t acid_size, char *aci0_sac, uint32_t aci0_size) {
|
||||
/* Parse the ACID sac. */
|
||||
sac_entry_t *acid_accesses = NULL;
|
||||
sac_entry_t *acid_hosts = NULL;
|
||||
|
@ -558,7 +558,7 @@ void sac_print(char *acid_sac, uint32_t acid_size, char *aci0_sac, uint32_t aci0
|
|||
|
||||
|
||||
|
||||
void fac_print(fac_t *fac, fah_t *fah) {
|
||||
static void fac_print(fac_t *fac, fah_t *fah) {
|
||||
if (fac->version == fah->version) {
|
||||
printf(" Version: %"PRId32"\n", fac->version);
|
||||
} else {
|
||||
|
@ -705,7 +705,7 @@ void cJSON_AddU64ToObject(cJSON *obj, char *name, uint64_t val) {
|
|||
cJSON_AddStringToObject(obj, name, buf);
|
||||
}
|
||||
|
||||
cJSON *sac_get_json(char *sac, uint32_t sac_size) {
|
||||
static cJSON *sac_get_json(char *sac, uint32_t sac_size) {
|
||||
cJSON *sac_json = cJSON_CreateObject();
|
||||
char service[9] = {0};
|
||||
uint32_t ofs = 0;
|
||||
|
|
2
nso.c
2
nso.c
|
@ -3,7 +3,7 @@
|
|||
#include "lz4.h"
|
||||
#include "sha.h"
|
||||
|
||||
void *nso_uncompress(nso0_ctx_t *ctx) {
|
||||
static void *nso_uncompress(nso0_ctx_t *ctx) {
|
||||
/* Make new header with correct sizes, fixed flags. */
|
||||
nso0_header_t new_header = *ctx->header;
|
||||
for (unsigned int i = 0; i < 3; i++) {
|
||||
|
|
|
@ -235,7 +235,7 @@ void pk21_process(pk21_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
const char *pk21_get_section_name(int section) {
|
||||
static const char *pk21_get_section_name(int section) {
|
||||
switch (section) {
|
||||
case 0: return "Kernel";
|
||||
case 1: return "INI1";
|
||||
|
|
2
pfs0.c
2
pfs0.c
|
@ -73,7 +73,7 @@ void pfs0_process(pfs0_ctx_t *ctx) {
|
|||
|
||||
}
|
||||
|
||||
void pfs0_save_file(pfs0_ctx_t *ctx, uint32_t i, filepath_t *dirpath) {
|
||||
static void pfs0_save_file(pfs0_ctx_t *ctx, uint32_t i, filepath_t *dirpath) {
|
||||
if (i >= ctx->header->num_files) {
|
||||
fprintf(stderr, "Could not save file %"PRId32"!\n", i);
|
||||
exit(EXIT_FAILURE);
|
||||
|
|
12
pki.c
12
pki.c
|
@ -4,7 +4,7 @@
|
|||
#include "pki.h"
|
||||
|
||||
/* Keydata for very early beta NCA0 archives' RSA-OAEP. */
|
||||
const unsigned char beta_nca0_modulus[0x100] = {
|
||||
static const unsigned char beta_nca0_modulus[0x100] = {
|
||||
0xAD, 0x58, 0xEE, 0x97, 0xF9, 0x47, 0x90, 0x7D, 0xF9, 0x29, 0x5F, 0x1F, 0x39, 0x68, 0xEE, 0x49,
|
||||
0x4C, 0x1E, 0x8D, 0x84, 0x91, 0x31, 0x5D, 0xE5, 0x96, 0x27, 0xB2, 0xB3, 0x59, 0x7B, 0xDE, 0xFD,
|
||||
0xB7, 0xEB, 0x40, 0xA1, 0xE7, 0xEB, 0xDC, 0x60, 0xD0, 0x3D, 0xC5, 0x50, 0x92, 0xAD, 0x3D, 0xC4,
|
||||
|
@ -24,7 +24,7 @@ const unsigned char beta_nca0_modulus[0x100] = {
|
|||
};
|
||||
|
||||
|
||||
unsigned char beta_nca0_exponent[0x100] = {
|
||||
static unsigned char beta_nca0_exponent[0x100] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -43,7 +43,7 @@ unsigned char beta_nca0_exponent[0x100] = {
|
|||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01
|
||||
};
|
||||
|
||||
const unsigned char beta_nca0_label_hash[0x20] = {
|
||||
static const unsigned char beta_nca0_label_hash[0x20] = {
|
||||
0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC, 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24,
|
||||
0x27, 0xAE, 0x41, 0xE4, 0x64, 0x9B, 0x93, 0x4C, 0xA4, 0x95, 0x99, 0x1B, 0x78, 0x52, 0xB8, 0x55
|
||||
};
|
||||
|
@ -66,7 +66,7 @@ const unsigned char *pki_get_beta_nca0_label_hash(void) {
|
|||
}
|
||||
|
||||
|
||||
const nca_keyset_t nca_keys_retail = {
|
||||
static const nca_keyset_t nca_keys_retail = {
|
||||
ZEROES_KEY, /* Secure Boot Key (CONSOLE UNIQUE) */
|
||||
ZEROES_KEY, /* TSEC Key (CONSOLE UNIQUE) */
|
||||
{
|
||||
|
@ -486,7 +486,7 @@ const nca_keyset_t nca_keys_retail = {
|
|||
}
|
||||
};
|
||||
|
||||
const nca_keyset_t nca_keys_dev = {
|
||||
static const nca_keyset_t nca_keys_dev = {
|
||||
ZEROES_KEY, /* Secure Boot Key (CONSOLE UNIQUE) */
|
||||
ZEROES_KEY, /* TSEC Key (CONSOLE UNIQUE) */
|
||||
{
|
||||
|
@ -907,7 +907,7 @@ const nca_keyset_t nca_keys_dev = {
|
|||
};
|
||||
|
||||
|
||||
void generate_kek(unsigned char *dst, const unsigned char *src, const unsigned char *master_key, const unsigned char *kek_seed, const unsigned char *key_seed) {
|
||||
static void generate_kek(unsigned char *dst, const unsigned char *src, const unsigned char *master_key, const unsigned char *kek_seed, const unsigned char *key_seed) {
|
||||
unsigned char kek[0x10];
|
||||
unsigned char src_kek[0x10];
|
||||
aes_ctx_t *master_ctx = new_aes_ctx(master_key, 0x10, AES_MODE_ECB);
|
||||
|
|
4
romfs.c
4
romfs.c
|
@ -4,7 +4,7 @@
|
|||
#include "ivfc.h"
|
||||
|
||||
/* RomFS functions... */
|
||||
void romfs_visit_file(romfs_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
static void romfs_visit_file(romfs_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_path) {
|
||||
romfs_fentry_t *entry = romfs_get_fentry(ctx->files, file_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
@ -32,7 +32,7 @@ void romfs_visit_file(romfs_ctx_t *ctx, uint32_t file_offset, filepath_t *dir_pa
|
|||
}
|
||||
}
|
||||
|
||||
void romfs_visit_dir(romfs_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
static void romfs_visit_dir(romfs_ctx_t *ctx, uint32_t dir_offset, filepath_t *parent_path) {
|
||||
romfs_direntry_t *entry = romfs_get_direntry(ctx->directories, dir_offset);
|
||||
filepath_t *cur_path = calloc(1, sizeof(filepath_t));
|
||||
if (cur_path == NULL) {
|
||||
|
|
6
xci.c
6
xci.c
|
@ -5,7 +5,7 @@
|
|||
/* This RSA-PKCS1 public key is only accessible to the gamecard controller. */
|
||||
/* However, it (and other XCI keys) can be dumped with a GCD attack on two signatures. */
|
||||
/* Contact SciresM for details, if curious. */
|
||||
const unsigned char xci_header_pubk[0x100] = {
|
||||
static const unsigned char xci_header_pubk[0x100] = {
|
||||
0x98, 0xC7, 0x26, 0xB6, 0x0D, 0x0A, 0x50, 0xA7, 0x39, 0x21, 0x0A, 0xE3, 0x2F, 0xE4, 0x3E, 0x2E,
|
||||
0x5B, 0xA2, 0x86, 0x75, 0xAA, 0x5C, 0xEE, 0x34, 0xF1, 0xA3, 0x3A, 0x7E, 0xBD, 0x90, 0x4E, 0xF7,
|
||||
0x8D, 0xFA, 0x17, 0xAA, 0x6B, 0xC6, 0x36, 0x6D, 0x4C, 0x9A, 0x6D, 0x57, 0x2F, 0x80, 0xA2, 0xBC,
|
||||
|
@ -186,7 +186,7 @@ void xci_save(xci_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
char *xci_get_cartridge_type(xci_ctx_t *ctx) {
|
||||
static const char *xci_get_cartridge_type(xci_ctx_t *ctx) {
|
||||
cartridge_type_t cart_type = (cartridge_type_t)ctx->header.cart_type;
|
||||
switch (cart_type) {
|
||||
case CARTSIZE_2GB: return "2GB";
|
||||
|
@ -198,7 +198,7 @@ char *xci_get_cartridge_type(xci_ctx_t *ctx) {
|
|||
}
|
||||
}
|
||||
|
||||
void xci_print_hfs0(hfs0_ctx_t *ctx) {
|
||||
static void xci_print_hfs0(hfs0_ctx_t *ctx) {
|
||||
print_magic(" Magic: ", ctx->header->magic);
|
||||
printf(" Offset: %012"PRIx64"\n", ctx->offset);
|
||||
printf(" Number of files: %"PRId32"\n", ctx->header->num_files);
|
||||
|
|
Loading…
Reference in a new issue