1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-12-23 09:02:06 +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_AesCtr = 3,
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;
typedef struct {

View file

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

View file

@ -90,8 +90,6 @@ typedef struct {
typedef struct {
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 size; ///< RomFS size.
RomFileSystemHeader header; ///< RomFS header.