ctrtool: Add support for inline decryption

This commit is contained in:
Michael Scire
2017-05-19 08:34:50 -07:00
parent 7dcc166403
commit 4c63561224
17 changed files with 502 additions and 148 deletions
+15
View File
@@ -20,6 +20,19 @@ typedef enum
NCCHTYPE_PLAINRGN = 5,
} ctr_ncchtypes;
typedef enum
{
NCCHCRYPTO_NONE = 0, //< already decrypted
NCCHCRYPTO_FIXED = 1, //< fixed key crypto, used for SDK-made application titles and very very old system titles
NCCHCRYPTO_OLD = (1<<1), //< crypto used before 7.0
NCCHCRYPTO_SEVEN = (1<<2), //< crypto used starting with 7.0
NCCHCRYPTO_NINETHREE = (1<<3), //< crypto used on N3DS starting with 9.3
NCCHCRYPTO_NINESIX = (1<<4), //< crypto used on N3DS starting with 9.6
NCCHCRYPTO_SEED = (1<<5), //< crypto used starting with 9.6 for preloading titles
NCCHCRYPTO_SPECIAL_FSES = NCCHCRYPTO_SEVEN | NCCHCRYPTO_NINETHREE | NCCHCRYPTO_NINESIX | NCCHCRYPTO_SEED, //< ExeFS and RomFS need new keys
NCCHCRYPTO_BROKEN = 0xFF //< Internal: seed crypto required but no seed set
} ctr_ncchcryptotype;
typedef struct
{
u8 signature[0x100];
@@ -58,6 +71,8 @@ typedef struct
{
FILE* file;
u8 key[16];
u8 special_key[16]; // used with the 7.x+ crypto methods
u8 seed[16];
u32 encrypted;
u64 offset;
u64 size;