diff --git a/makerom/keyset.c b/makerom/keyset.c index 4ff402e..c706c91 100644 --- a/makerom/keyset.c +++ b/makerom/keyset.c @@ -73,7 +73,7 @@ int LoadKeysFromResources(keys_struct *keys) /* AES Keys */ // CIA //SetCommonKey(keys, zeros_aesKey,1); - if(keys->aes.currentCommonKey > 0xff) + if(keys->aes.currentCommonKey > MAX_CMN_KEY) SetCurrentCommonKey(keys,0); // NCCH @@ -101,7 +101,7 @@ int LoadKeysFromResources(keys_struct *keys) for(int i = 0; i < 6; i++) SetCommonKey(keys, ctr_common_etd_key_dpki[i],i); - if(keys->aes.currentCommonKey > 0xff) + if(keys->aes.currentCommonKey > MAX_CMN_KEY) SetCurrentCommonKey(keys,0); // NCCH @@ -133,7 +133,7 @@ int LoadKeysFromResources(keys_struct *keys) for (int i = 0; i < 6; i++) SetCommonKey(keys, ctr_common_etd_key_ppki[i], i); - if(keys->aes.currentCommonKey > 0xff) + if(keys->aes.currentCommonKey > MAX_CMN_KEY) SetCurrentCommonKey(keys,0); // NCCH diff --git a/makerom/keyset.h b/makerom/keyset.h index 2a35b38..887f3de 100644 --- a/makerom/keyset.h +++ b/makerom/keyset.h @@ -4,7 +4,7 @@ typedef enum { AES_128_KEY_SIZE = 16, - MAX_CMN_KEY = MAX_U8, + MAX_CMN_KEY = 0x05, MAX_NCCH_KEYX = MAX_U8 } keydata_limits; diff --git a/makerom/user_settings.c b/makerom/user_settings.c index f995857..67f4a5d 100644 --- a/makerom/user_settings.c +++ b/makerom/user_settings.c @@ -89,6 +89,7 @@ void SetDefaults(user_settings *set) // Build NCCH Info set->ncch.useSecCrypto = true; + set->ncch.keyXID = 0; set->ncch.buildNcch0 = true; set->ncch.includeExefsLogo = false; set->common.outFormat = NCCH; @@ -115,7 +116,7 @@ void SetDefaults(user_settings *set) set->cia.useDataTitleVer = false; set->cia.useFullTitleVer = false; set->cia.randomTitleKey = false; - set->common.keys.aes.currentCommonKey = MAX_U8 + 1; // invalid so changes can be detected + set->common.keys.aes.currentCommonKey = 0; for (int i = 0; i < CIA_MAX_CONTENT; i++) set->cia.contentId[i] = MAX_U32 + 1; // invalid so changes can be detected } @@ -196,7 +197,6 @@ int SetArgument(int argc, int i, char *argv[], user_settings *set) } return 2; } - /* else if (strcmp(argv[i], "-ckeyid") == 0) { if (ParamNum != 1) { PrintArgReqParam(argv[i], 1); @@ -224,7 +224,6 @@ int SetArgument(int argc, int i, char *argv[], user_settings *set) } return 2; } - */ else if (strcmp(argv[i], "-showkeys") == 0) { if (ParamNum) { PrintNoNeedParam(argv[i]); @@ -903,7 +902,7 @@ void PrintNoNeedParam(char *arg) void DisplayBanner(void) { - printf("CTR MAKEROM v0.16 (C) 3DSGuy 2017\n"); + printf("CTR MAKEROM v0.16.1 (C) 3DSGuy 2017\n"); printf("Built: %s %s\n\n", __TIME__, __DATE__); } @@ -952,10 +951,16 @@ void DisplayExtendedHelp(char *app_name) printf(" 't' Test(false) Keys & prod Certs\n"); printf(" 'd' Development Keys & Certs\n"); printf(" 'p' Production Keys & Certs\n"); - //printf(" -ckeyid Override the automatic common key selection\n"); - //printf(" -ncchseckey Ncch keyX index ('0'=1.0+, '1'=7.0+)\n"); + printf(" -ckeyid Ticket Common Key Index, defaults to 0x00\n"); + printf(" 0x00 : Applications / eShop\n"); + printf(" 0x01 : System Titles\n"); + printf(" 0x02-0x05 : Unused\n"); + printf(" -ncchseckey NCCH KeyX index, defaults to 0x00\n"); + printf(" 0x00 : FW 1.0.0+\n"); + printf(" 0x01 : FW 7.0.0+\n"); + printf(" 0x0a : FW 9.3.0+ (New3DS only)\n"); + printf(" 0x0b : FW 9.6.0+ (New3DS only)\n"); printf(" -showkeys Display the loaded key chain\n"); - //printf(" -fsign False sign digital signatures\n"); printf(" -ignoresign Ignore invalid signatures\n"); printf("NCCH OPTIONS:\n"); printf(" -elf ELF file\n");