1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 18:26:39 +00:00

Tidy up GameCardFwVersion, NcaKeyGeneration and NcaMainSignatureKeyGeneration enums.

Thanks @0Liam
This commit is contained in:
Pablo Curiel 2021-06-03 10:46:21 -04:00
parent 96c7a35e20
commit c0e82b3686
3 changed files with 38 additions and 41 deletions

View file

@ -122,11 +122,11 @@ typedef enum {
typedef enum {
GameCardFwVersion_ForDev = 0,
GameCardFwVersion_ForProd = 1,
GameCardFwVersion_ForProdSince400NUP = 2, ///< upp_version >= 268435456 (4.0.0-0.0) in GameCardInfo.
GameCardFwVersion_ForDevSince1100NUP = 3, ///< upp_version >= 738197504 (11.0.0-0.0) in GameCardInfo.
GameCardFwVersion_ForProdSince1100NUP = 4, ///< upp_version >= 738197504 (11.0.0-0.0) in GameCardInfo.
GameCardFwVersion_ForProdSince1200NUP = 5, ///< upp_version >= 805306368 (12.0.0-0.0) in GameCardInfo.
GameCardFwVersion_Since100NUP = 1, ///< upp_version >= 0 (0.0.0-0.0) in GameCardInfo.
GameCardFwVersion_Since400NUP = 2, ///< upp_version >= 268435456 (4.0.0-0.0) in GameCardInfo.
GameCardFwVersion_Since900NUP = 3, ///< upp_version >= 603979776 (9.0.0-0.0) in GameCardInfo. Seems to be unused.
GameCardFwVersion_Since1100NUP = 4, ///< upp_version >= 738197504 (11.0.0-0.0) in GameCardInfo.
GameCardFwVersion_Since1200NUP = 5, ///< upp_version >= 805306368 (12.0.0-0.0) in GameCardInfo.
GameCardFwVersion_Count = 6
} GameCardFwVersion;
@ -202,7 +202,7 @@ typedef enum {
typedef enum {
GameCardHashFileSystemPartitionType_Root = 0,
GameCardHashFileSystemPartitionType_Update = 1,
GameCardHashFileSystemPartitionType_Logo = 2, ///< Only available in GameCardFwVersion_Since400NUP gamecards.
GameCardHashFileSystemPartitionType_Logo = 2, ///< Only available in GameCardFwVersion_Since400NUP or greater gamecards.
GameCardHashFileSystemPartitionType_Normal = 3,
GameCardHashFileSystemPartitionType_Secure = 4,
GameCardHashFileSystemPartitionType_Boot = 5,

View file

@ -69,10 +69,22 @@ typedef enum {
NcaContentType_PublicData = 5
} NcaContentType;
/// 'NcaKeyGeneration_Current' will always point to the last known key generation value.
typedef enum {
NcaKeyGenerationOld_100_230 = 0,
NcaKeyGenerationOld_300 = 2
} NcaKeyGenerationOld;
NcaKeyGeneration_Since100NUP = 0, ///< 1.0.0 - 2.3.0.
NcaKeyGeneration_Since300NUP = 2, ///< 3.0.0.
NcaKeyGeneration_Since301NUP = 3, ///< 3.0.1 - 3.0.2.
NcaKeyGeneration_Since400NUP = 4, ///< 4.0.0 - 4.1.0.
NcaKeyGeneration_Since500NUP = 5, ///< 5.0.0 - 5.1.0.
NcaKeyGeneration_Since600NUP = 6, ///< 6.0.0 - 6.1.0.
NcaKeyGeneration_Since620NUP = 7, ///< 6.2.0.
NcaKeyGeneration_Since700NUP = 8, ///< 7.0.0 - 8.0.1.
NcaKeyGeneration_Since810NUP = 9, ///< 8.1.0 - 8.1.1.
NcaKeyGeneration_Since900NUP = 10, ///< 9.0.0 - 9.0.1.
NcaKeyGeneration_Since910NUP = 11, ///< 9.1.0 - 12.0.2.
NcaKeyGeneration_Current = NcaKeyGeneration_Since910NUP,
NcaKeyGeneration_Max = 32
} NcaKeyGeneration;
typedef enum {
NcaKeyAreaEncryptionKeyIndex_Application = 0,
@ -81,26 +93,11 @@ typedef enum {
NcaKeyAreaEncryptionKeyIndex_Count = 3
} NcaKeyAreaEncryptionKeyIndex;
/// 'NcaKeyGeneration_Current' will always point to the last known key generation value.
typedef enum {
NcaKeyGeneration_301_302 = 3,
NcaKeyGeneration_400_410 = 4,
NcaKeyGeneration_500_510 = 5,
NcaKeyGeneration_600_610 = 6,
NcaKeyGeneration_620 = 7,
NcaKeyGeneration_700_801 = 8,
NcaKeyGeneration_810_811 = 9,
NcaKeyGeneration_900_901 = 10,
NcaKeyGeneration_910_1202 = 11,
NcaKeyGeneration_Current = NcaKeyGeneration_910_1202,
NcaKeyGeneration_Max = 32
} NcaKeyGeneration;
/// 'NcaMainSignatureKeyGeneration_Current' will always point to the last known key generation value.
typedef enum {
NcaMainSignatureKeyGeneration_100_811 = 0,
NcaMainSignatureKeyGeneration_900_1202 = 1,
NcaMainSignatureKeyGeneration_Current = NcaMainSignatureKeyGeneration_900_1202,
NcaMainSignatureKeyGeneration_Since100NUP = 0, ///< 1.0.0 - 8.1.1.
NcaMainSignatureKeyGeneration_Since900NUP = 1, ///< 9.0.0 - 12.0.2.
NcaMainSignatureKeyGeneration_Current = NcaMainSignatureKeyGeneration_Since900NUP,
NcaMainSignatureKeyGeneration_Max = (NcaMainSignatureKeyGeneration_Current + 1)
} NcaMainSignatureKeyGeneration;
@ -140,13 +137,13 @@ typedef struct {
u32 magic; ///< "NCA0" / "NCA2" / "NCA3".
u8 distribution_type; ///< NcaDistributionType.
u8 content_type; ///< NcaContentType.
u8 key_generation_old; ///< NcaKeyGenerationOld.
u8 key_generation_old; ///< NcaKeyGeneration. Only uses NcaKeyGeneration_Since100NUP and NcaKeyGeneration_Since300NUP values.
u8 kaek_index; ///< NcaKeyAreaEncryptionKeyIndex.
u64 content_size;
u64 program_id;
u32 content_index;
VersionType2 sdk_addon_version;
u8 key_generation; ///< NcaKeyGeneration.
u8 key_generation; ///< NcaKeyGeneration. Uses NcaKeyGeneration_Since301NUP or greater values.
u8 main_signature_key_generation; ///< NcaMainSignatureKeyGeneration.
u8 reserved[0xE];
FsRightsId rights_id; ///< Used for titlekey crypto.
@ -365,7 +362,7 @@ typedef struct {
u8 format_version; ///< NcaVersion.
u8 content_type; ///< NcmContentType. Retrieved from NcmContentInfo.
u64 content_size; ///< Retrieved from NcmContentInfo.
u8 key_generation; ///< NcaKeyGenerationOld / NcaKeyGeneration. Retrieved from the decrypted header.
u8 key_generation; ///< NcaKeyGeneration. Retrieved from the decrypted header.
u8 id_offset; ///< Retrieved from NcmContentInfo.
bool rights_id_available;
bool titlekey_retrieved;

View file

@ -164,8 +164,8 @@ static KeysMemoryInfo g_fsRodataMemoryInfo = {
0xF9, 0x2E, 0x84, 0x98, 0x17, 0x2C, 0xAF, 0x9C, 0x20, 0xE3, 0xF1, 0xF7, 0xD3, 0xE7, 0x2C, 0x62,
0x50, 0xA9, 0x40, 0x7A, 0xE7, 0x84, 0xE0, 0x03, 0x58, 0x07, 0x85, 0xA5, 0x68, 0x0B, 0x80, 0x33
},
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_100_811]),
.dst = g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_100_811],
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_Since100NUP]),
.dst = g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_Since100NUP],
.mandatory_func = &keysIsProductionModulus1xMandatory
},
{
@ -174,8 +174,8 @@ static KeysMemoryInfo g_fsRodataMemoryInfo = {
0x5F, 0x6B, 0xE3, 0x1C, 0x31, 0x6E, 0x7C, 0xB2, 0x1C, 0xA7, 0xB9, 0xA1, 0x70, 0x6A, 0x9D, 0x58,
0x04, 0xEB, 0x90, 0x53, 0x72, 0xEF, 0xCB, 0x56, 0xD1, 0x93, 0xF2, 0xAF, 0x9E, 0x8A, 0xD1, 0xFA
},
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_900_1202]),
.dst = g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_900_1202],
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_Since900NUP]),
.dst = g_ncaKeyset.nca_main_signature_moduli_prod[NcaMainSignatureKeyGeneration_Since900NUP],
.mandatory_func = &keysIsProductionModulus9xMandatory
},
{
@ -184,8 +184,8 @@ static KeysMemoryInfo g_fsRodataMemoryInfo = {
0x50, 0xF8, 0x26, 0xBB, 0x13, 0xFE, 0xB2, 0x6D, 0x83, 0xCF, 0xFF, 0xD8, 0x38, 0x45, 0xC3, 0x51,
0x4D, 0xCB, 0x06, 0x91, 0x83, 0x52, 0x06, 0x35, 0x7A, 0xC1, 0xDA, 0x6B, 0xF1, 0x60, 0x9F, 0x18
},
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_100_811]),
.dst = g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_100_811],
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_Since100NUP]),
.dst = g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_Since100NUP],
.mandatory_func = &keysIsDevelopmentModulus1xMandatory
},
{
@ -194,8 +194,8 @@ static KeysMemoryInfo g_fsRodataMemoryInfo = {
0x56, 0xF5, 0x06, 0xEF, 0x8E, 0xCA, 0x2A, 0x29, 0x6F, 0x65, 0x45, 0xE1, 0x87, 0x60, 0x01, 0x11,
0xBC, 0xC7, 0x38, 0x56, 0x99, 0x16, 0xAD, 0xA5, 0xDD, 0x89, 0xF2, 0xE9, 0xAB, 0x28, 0x5B, 0x18
},
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_900_1202]),
.dst = g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_900_1202],
.size = sizeof(g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_Since900NUP]),
.dst = g_ncaKeyset.nca_main_signature_moduli_dev[NcaMainSignatureKeyGeneration_Since900NUP],
.mandatory_func = &keysIsDevelopmentModulus9xMandatory
},
{