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

Remove unnecessary RomFS context members.

This commit is contained in:
Pablo Curiel 2020-04-29 07:55:23 -04:00
parent 08bfb89adb
commit 7aa72dc618
3 changed files with 7 additions and 15 deletions

View file

@ -125,7 +125,7 @@ typedef enum {
NcaEncryptionType_AesXts = 2, NcaEncryptionType_AesXts = 2,
NcaEncryptionType_AesCtr = 3, NcaEncryptionType_AesCtr = 3,
NcaEncryptionType_AesCtrEx = 4, NcaEncryptionType_AesCtrEx = 4,
NcaEncryptionType_Nca0 = 5 ///< Only used to represent NCA0 AES XTS FS section crypto - not actually used as a possible value for this field. NcaEncryptionType_Nca0 = 5 ///< Only used to represent NCA0 AES-XTS FS section crypto - not actually used as a possible value for this field.
} NcaEncryptionType; } NcaEncryptionType;
typedef struct { typedef struct {

View file

@ -51,29 +51,23 @@ bool romfsInitializeContext(RomFileSystemContext *out, NcaFsSectionContext *nca_
if (nca_fs_ctx->section_type == NcaFsSectionType_Nca0RomFs) if (nca_fs_ctx->section_type == NcaFsSectionType_Nca0RomFs)
{ {
out->sha256_hash_info = &(nca_fs_ctx->header->hash_info.hierarchical_sha256); if (!ncaValidateHierarchicalSha256Offsets(&(nca_fs_ctx->header->hash_info.hierarchical_sha256), nca_fs_ctx->section_size))
out->integrity_hash_info = NULL;
if (!ncaValidateHierarchicalSha256Offsets(out->sha256_hash_info, nca_fs_ctx->section_size))
{ {
LOGFILE("Invalid HierarchicalSha256 block!"); LOGFILE("Invalid HierarchicalSha256 block!");
return false; return false;
} }
out->offset = out->sha256_hash_info->hash_target_layer_info.offset; out->offset = nca_fs_ctx->header->hash_info.hierarchical_sha256.hash_target_layer_info.offset;
out->size = out->sha256_hash_info->hash_target_layer_info.size; out->size = nca_fs_ctx->header->hash_info.hierarchical_sha256.hash_target_layer_info.size;
} else { } else {
out->sha256_hash_info = NULL; if (!ncaValidateHierarchicalIntegrityOffsets(&(nca_fs_ctx->header->hash_info.hierarchical_integrity), nca_fs_ctx->section_size))
out->integrity_hash_info = &(nca_fs_ctx->header->hash_info.hierarchical_integrity);
if (!ncaValidateHierarchicalIntegrityOffsets(out->integrity_hash_info, nca_fs_ctx->section_size))
{ {
LOGFILE("Invalid HierarchicalIntegrity block!"); LOGFILE("Invalid HierarchicalIntegrity block!");
return false; return false;
} }
out->offset = out->integrity_hash_info->hash_target_layer_info.offset; out->offset = nca_fs_ctx->header->hash_info.hierarchical_integrity.hash_target_layer_info.offset;
out->size = out->integrity_hash_info->hash_target_layer_info.size; out->size = nca_fs_ctx->header->hash_info.hierarchical_integrity.hash_target_layer_info.size;
} }
/* Read RomFS header */ /* Read RomFS header */

View file

@ -90,8 +90,6 @@ typedef struct {
typedef struct { typedef struct {
NcaFsSectionContext *nca_fs_ctx; ///< Used to read NCA FS section data. NcaFsSectionContext *nca_fs_ctx; ///< Used to read NCA FS section data.
NcaHierarchicalSha256 *sha256_hash_info; ///< HierarchicalSha256 hash table information. Used with NCA0 RomFS sections.
NcaHierarchicalIntegrity *integrity_hash_info; ///< HierarchicalIntegrity hash table information. Used with NCA2/NCA3 RomFS sections.
u64 offset; ///< RomFS offset (relative to the start of the NCA FS section). u64 offset; ///< RomFS offset (relative to the start of the NCA FS section).
u64 size; ///< RomFS size. u64 size; ///< RomFS size.
RomFileSystemHeader header; ///< RomFS header. RomFileSystemHeader header; ///< RomFS header.