From d785159827e2ed5b925e7ef6e13f1b3161a2e4e7 Mon Sep 17 00:00:00 2001 From: d0k3 Date: Wed, 7 Jun 2017 12:42:24 +0200 Subject: [PATCH] Remove support for the secret_sector.bin support file --- README.md | 4 +--- source/filesys/filetype.c | 4 ---- source/filesys/filetype.h | 1 - source/godmode.c | 13 ++----------- source/nand/nand.c | 15 --------------- source/nand/nand.h | 4 ---- 6 files changed, 3 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 7563bed..2eebe86 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,8 @@ GodMode9 provides a write permissions system, which will protect you from accide ## Support files For certain functionality, GodMode9 may need 'support files'. Support files can be placed into either `0:/`(the SD root folder), `0:/files9/` or `1:/rw/files9/` (all locations will work). Support files contain additional information that is required in decryption operations. A list of support files, and what they do, is found below. Please don't ask for support files - find them yourself. -* __`aeskeydb.bin`__: This should contain 0x25keyX, 0x18keyX and 0x1BkeyX to enable decryption of 7x / Secure3 / Secure4 encrypted NCCH files and 0x11key95 / 0x11key96 for FIRM decrypt support. It can be created from your existing legacy `slot0x??key?.bin`files in Decrypt9 via the 'Build Key Database' feature. As an alternative (not recommended), legacy `slot0x??key?.bin` files are also supported in GodMode9. *`aeskeydb.bin` should no more be required on sighaxed systems*. +* __`aeskeydb.bin`__: This should contain 0x25keyX, 0x18keyX and 0x1BkeyX to enable decryption of 7x / Secure3 / Secure4 encrypted NCCH files, 0x11key95 / 0x11key96 for FIRM decrypt support and 0x11keyOTP / 0x11keyIVOTP for 'secret' sector 0x96 crypto support. It can be created from your existing legacy `slot0x??key?.bin`files in Decrypt9 via the 'Build Key Database' feature. As an alternative (not recommended), legacy `slot0x??key?.bin` files are also supported in GodMode9. *`aeskeydb.bin` should no more be required on sighaxed systems*. * __`seeddb.bin`__: This file is required to decrypt and mount seed encrypted NCCHs and CIAs if the seed in question is not installed to your NAND. Note that your seeddb.bin must also contain the seed for the specific game you need to decrypt. -* __`otp.bin`__: This file is console-unique and is required - on legacy entrypoints (other than A9LH & Sighax) - for decryption of the 'secret' sector 0x96 on N3DS (and O3DS with a9lh installed). -* __`sector0x96.bin`__ / __`secret_sector.bin`__ : A copy of the decrypted, untouched (non-a9lh) secret sector. This is required for decryption of the encrypted ARM9 section of N3DS FIRMs. It is not required for anything else. As an alternative you can also provide the required keys inside your aeskeydb.bin. * __`encTitleKeys.bin`__ / __`decTitleKeys.bin`__: These files are optional and provide titlekeys, which are required to create updatable CIAs from NCCH / NCSD files. CIAs created without these files will still work, but won't be updatable from eShop. diff --git a/source/filesys/filetype.c b/source/filesys/filetype.c index cb2e12d..64f9b13 100644 --- a/source/filesys/filetype.c +++ b/source/filesys/filetype.c @@ -101,10 +101,6 @@ u32 IdentifyFileType(const char* path) { return BIN_KEYDB; // key database } else if ((sscanf(fname, "slot%02lXKey", &id) == 1) && (strncasecmp(ext, "bin", 4) == 0) && (fsize = 16) && (id < 0x40)) { return BIN_LEGKEY; // legacy key file - } else if ((strncasecmp(fname, SEEDDB_NAME, sizeof(SEEDDB_NAME)) == 0) || - (strncasecmp(fname, SECTOR_NAME, sizeof(SECTOR_NAME)) == 0) || - (strncasecmp(fname, SECRET_NAME, sizeof(SECRET_NAME)) == 0)) { - return BIN_SUPPORT; // known support file (so launching is not offered) #if PAYLOAD_MAX_SIZE <= TEMP_BUFFER_SIZE } else if ((fsize <= PAYLOAD_MAX_SIZE) && ext && (strncasecmp(ext, "bin", 4) == 0)) { return BIN_LAUNCH; // assume it's an ARM9 payload diff --git a/source/filesys/filetype.h b/source/filesys/filetype.h index 30a8560..9a4df2b 100644 --- a/source/filesys/filetype.h +++ b/source/filesys/filetype.h @@ -22,7 +22,6 @@ #define BIN_TIKDB (1UL<<17) #define BIN_KEYDB (1UL<<18) #define BIN_LEGKEY (1UL<<19) -#define BIN_SUPPORT (1UL<<20) #define TYPE_BASE 0x00FFFFFF // 24 bit reserved for base types #define FLAG_ENC (1UL<<28) diff --git a/source/godmode.c b/source/godmode.c index 42a53cd..b92fb45 100644 --- a/source/godmode.c +++ b/source/godmode.c @@ -1287,19 +1287,10 @@ u32 HomeMoreMenu(char* current_path, DirStruct* current_dir, DirStruct* clipboar if (!seed_sys || BuildSeedInfo(NULL, true) != 0) seed_sys = seed_emu = false; } - bool lsector = false; - u8 legit_sector[0x200]; - if (GetLegitSector0x96(legit_sector) == 0) { - ShowString("Searching secret sector..."); - const char* path_sector = OUTPUT_PATH "/" SECRET_NAME; - // we can safely assume the output path exists at that point - lsector = FileSetData(path_sector, legit_sector, 0x200, 0, true); - } - ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%18.18-s %s\n%18.18-s %s\n%18.18-s %s\n%18.18-s %s", + ShowPrompt(false, "Built in " OUTPUT_PATH ":\n \n%18.18-s %s\n%18.18-s %s\n%18.18-s %s", TIKDB_NAME_ENC, tik_enc_sys ? tik_enc_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed", TIKDB_NAME_DEC, tik_dec_sys ? tik_dec_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed", - SEEDDB_NAME, seed_sys ? seed_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed", - SECRET_NAME, lsector ? "OK (legit)" : "Failed"); + SEEDDB_NAME, seed_sys ? seed_emu ? "OK (Sys&Emu)" : "OK (Sys)" : "Failed"); GetDirContents(current_dir, current_path); return 0; } else if (user_select == hsrestore) { // restore Health & Safety diff --git a/source/nand/nand.c b/source/nand/nand.c index af451e7..f5c1ab1 100644 --- a/source/nand/nand.c +++ b/source/nand/nand.c @@ -1,6 +1,5 @@ #include "nand.h" #include "fsdrive.h" -#include "fsutil.h" #include "unittype.h" #include "keydb.h" #include "aes.h" @@ -537,20 +536,6 @@ u32 GetLegitSector0x96(u8* sector) return 0; } - // no luck? try searching for a file - const char* base[] = { INPUT_PATHS }; - for (u32 i = 0; i < (sizeof(base)/sizeof(char*)); i++) { - char path[64]; - snprintf(path, 64, "%s/%s", base[i], SECTOR_NAME); - if ((FileGetData(path, sector, 0x200, 0) == 0x200) && - (sha_cmp(SECTOR_SHA256, sector, 0x200, SHA256_MODE) == 0)) - return 0; - snprintf(path, 64, "%s/%s", base[i], SECRET_NAME); - if ((FileGetData(path, sector, 0x200, 0) == 0x200) && - (sha_cmp(SECTOR_SHA256, sector, 0x200, SHA256_MODE) == 0)) - return 0; - } - // failed if we arrive here return 1; } diff --git a/source/nand/nand.h b/source/nand/nand.h index 0d82bf1..f6a3c7a 100644 --- a/source/nand/nand.h +++ b/source/nand/nand.h @@ -11,10 +11,6 @@ #define SECTOR_D0K3 0x000001 #define SECTOR_SECRET 0x000096 -// filenames for sector 0x96 -#define SECTOR_NAME "sector0x96.bin" -#define SECRET_NAME "secret_sector.bin" - // 0x110...0x118 in the NAND NCSD header // see: https://www.3dbrew.org/wiki/NCSD#NCSD_header #define NP_TYPE_NONE 0