Repository navigation
feat(nx-object): add the NCA container and its content meta - #12
Merged
Merged
Conversation
An NSP is a set of NCAs plus the CNMT naming them, so packaging a title needs both formats; the builder stops at the plaintext container and names what encryption is still owed, keeping key material out of a crate whose contract is bytes in, bytes out. - Add `raw::nca` and `raw::cnmt`, covering the NCA header, its four section entries and FS headers, the PFS0 and RomFS superblocks, and the content meta's header, extended header, and content records - Add `write::nca::NcaBuilder`, which lays sections out at fixed indices, derives the IVFC tree or hash table verifying each, and returns a `PlainNca` whose `ctr_sections` name the ranges and counters the caller must still encrypt - Add `write::cnmt::CnmtBuilder`, deriving each NCA's name from its own hash and the patch title ID from the title ID, and sorting records so one set of contents produces one set of bytes - Gate both behind new `nca` and `cnmt` features, and state in the crate docs why encryption and signing stay outside this crate Signed-off-by: Lorenzo Delgado <lnsdev@proton.me>
Four of the wiki anchors added with the formats pointed at sections that do not exist, and reading the ones that do showed several fields documented as padding are named and used by the format; the layout was right, the description of it was not. - Repoint `NCA#SectionTableEntry`, `NCA#NcaFsHeader`, `NCA#NcaHeader` and `CNMT#PackagedContentMeta` at `FsEntry`, `FsHeader`, `Header` and `PackagedContentMetaHeader`, and add the references the IVFC and superblock structures were missing - Rename `IvfcHeader::id` to `version`, its trailing reserved block to `signature_salt`, `Pfs0Superblock::always_2` to `layer_count`, and the application extended header's reserved word to `required_application_version` - Say what the spans this crate zeroes actually hold: the `PatchInfo` following each superblock, the `Generation` and `SecureValue` making up a section counter, and the content meta's attributes and download floor - List NCA and CNMT in the README's format table and reference list, record both formats and their features in `AGENTS.md`, and note there that the crate hashes but never encrypts Signed-off-by: Lorenzo Delgado <lnsdev@proton.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An NSP is a set of NCAs plus the CNMT naming them, so packaging a title needs both formats; the builder stops at the plaintext container and names what encryption is still owed, keeping key material out of a crate whose contract is bytes in, bytes out.
raw::ncaandraw::cnmt, covering the NCA header, its four section entries and FS headers, the PFS0 and RomFS superblocks, and the content meta's header, extended header, and content recordswrite::nca::NcaBuilder, which lays sections out at fixed indices, derives the IVFC tree or hash table verifying each, and returns aPlainNcawhosectr_sectionsname the ranges and counters the caller must still encryptwrite::cnmt::CnmtBuilder, deriving each NCA's name from its own hash and the patch title ID from the title ID, and sorting records so one set of contents produces one set of bytesncaandcnmtfeatures, and state in the crate docs why encryption and signing stay outside this crate