Skip to content

fix: accept another genuine retail dump of the same version (ACID-signed npdm, other firmware fonts) - #47

Merged
ly05010419 merged 1 commit into
ly05010419:mainfrom
oneincase:fix/other-retail-dumps
Oct 19, 2026
Merged

ly05010419 merged 1 commit into
ly05010419:mainfrom
oneincase:fix/other-retail-dumps

Conversation

@oneincase

Copy link
Copy Markdown
Contributor

A pinned SHA-256 names the dump it was taken from, not every genuine dump of that version. From #45: a retail 1.0.0 NSP matched all four rewritten modules, but its main.npdm (890c6174… vs pinned f5a5eecc…) and four of the six shared fonts from firmware 22.5.0 did not match the pinned hashes; the dump is complete (every ExeFS block hash and IVFC level verifies) and its npdm verifies with Nintendo's public ACID signing key. Two of the six fonts are byte-identical to the reference dump's, which shows only the firmware version differs (README still says a retail NSP had not been tested).

This PR keeps the pinned hashes as the fast path and accepts another genuine dump of the same version:

  • main.npdm: when the pinned hash differs, verify the ACID block's RSA-2048 PSS/SHA-256 signature with Nintendo's public ACID signing key (key generation 0) — the check the Horizon loader itself makes (ValidateAcidSignature over acid->modulus .. acid->size; salt 32, MGF1-SHA256, trailer 0xBC). Only the npdm gets this exception; the other modules are still required byte-exact.
  • Shared fonts: a font from another firmware version is accepted when it is a structurally valid BFTTF (the same size check extract_shared_fonts.py makes) and is bound by the SHA-256 of its actual bytes, so manifest.json and shared_fonts_config.h describe exactly the bytes the runtime gets.
  • identify_update() and step_code() both go through the new exefs_matches(), so a cached extraction and an update's module hashes accept a signed npdm too.
  • Tests: a synthetic RSA-PSS npdm (accepted; tampered and other key generation rejected) and six synthetic valid BFTTF fonts accepted with their actual hashes while a corrupt one is refused.
  • README: both languages describe the acceptance rule.

End-to-end check (this branch, the repository's unmodified expected-v1.0.0.json): the retail 1.0.0 NSP from #45 built successfully — the log shows main.npdm is a Nintendo-signed 1.0.0 file from another dump; using it and four shared font … comes from another firmware version; its bytes are bound instead notes, then done in 18 min. python -m unittest discover -s tests: 85 tests, OK.

Fixes #45.

…05010419#45)

A pinned SHA-256 names the dump it was taken from, not every genuine one. A
retail 1.0.0 NSP matched the four rewritten modules, but its main.npdm and
four of the six shared fonts from firmware 22.5.0 did not match the pinned
hashes, and the build stopped: the dump is complete and Nintendo-signed, its
npdm verifies with Nintendo's public ACID key, and two of the six fonts are
byte-identical to the reference dump's.

- main.npdm: when the pinned hash differs, verify the ACID block's RSA-2048
  PSS/SHA-256 signature with Nintendo's public ACID signing key (key
  generation 0), exactly the check the Horizon loader makes (Atmosphere
  ldr_meta.cpp ValidateAcidSignature over acid->modulus .. acid->size). The
  pinned hash remains the fast path; other ExeFS modules are still required
  byte-exact.
- shared fonts: a font from another firmware version is accepted when it is a
  structurally valid BFTTF (the same size check extract_shared_fonts.py
  makes) and is bound by the SHA-256 of its actual bytes, so the manifest and
  shared_fonts_config.h describe the bytes the runtime gets.
- identify_update() and step_code() share exefs_matches(), so a cached
  extraction and an update's module hashes accept a signed npdm too.
- tests: synthetic RSA-PSS npdm (accepted, tampered and other key generation
  rejected) and six synthetic valid BFTTF fonts accepted with their actual
  hashes while a corrupt one is refused.
- README: both languages say other genuine dumps are accepted.

python -m unittest discover -s tests: 85 tests, OK.
@ly05010419
ly05010419 merged commit 232354b into ly05010419:main Oct 19, 2026
1 check passed
@oneincase
oneincase deleted the fix/other-retail-dumps branch October 20, 2026 01:33
ly05010419 added a commit that referenced this pull request Oct 20, 2026
…ultrawide HUD, 1.4.3 survey, mods, controls.txt) into the Breath of the Wild branch

Resolved by hand: nvn_mtl.m (PR #34's paged-bitmap serial sets keep the serial forgetting of 635fb31: totk_serial_del
clears a bit; the memory line shows both; the BotW frame reset stays in mtl_present), build_app.py (make -j and the
per-game launcher defines), the Makefile (the BotW targets and the Opus test), loader.c (the #57 stale-reference handler
and 1.4.3's survey return address are TOTK-only: Breath of the Wild has no GAME_ADDR for them), world_survey.c (BotW
keeps its stub, with runtime_survey_sync), README (both update-history rows).

Found by the merged build: Breath of the Wild lacked runtime_output_size_current (frontend.m's shortcut text) and
runtime_survey_sync (hle_nvn.c); and the add-on content file handles shared fs_host.c's 0x200000000 range, so closing a
host file at the title ended the game ("close invalid add-on content handle"): they now start at 0x400000000.

Tested on the merged binaries: TOTK 1.2.1 jump session (anomalies 0, occlusion normal, serial set 48,606 / 13 pages),
Breath of the Wild DLC + key 3 (k3a6) and key 2 (k2c, 11 of 12 pairs within 5 px).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retail 1.0.0 NSP fails the pinned main.npdm and four shared-font hashes (retail NSP input untested per README)

2 participants