decomp(aes): recover decrypt final-round dependency tree #1020

Merged
coah80 merged 1 commits from agent/bittle/aes-final-dependencies into main 2026-10-03 02:08:25 +00:00
coah80 commented 2026-10-03 02:07:45 +00:00 (Migrated from github.com)

Source reconstruction

Recover the target's key-inclusive final XOR tree (B ^ L) ^ (U ^ (key ^ H)) and direct context-indexed inverse-key transform rows. All operands remain unsigned, table indices unchanged and key expressions occur once. The previously reconstructed algorithms are retained; this is not a new AES implementation.

Independent parent verification

  • AESiDecryptBlock: 69.69323% → 72.30677%, 251/251 instructions; raw positional differences 227 → 219
  • Unit: 81.09157% → 82.04506%; encryption unchanged
  • Seven existing exact function streams unchanged; exact code1116 and data2800 preserved
  • Compared all1027 allocated objects: only AES .text changed, same2752-byte extent; no relocation/non-text changes and no report regressions
  • Parent independently compiled actual baseline and candidate with UBSan and passed2406 AES128/192/256 known-answer/randomized CBC cases each, including separate/in-place and single/incremental operation
  • Worker additionally checked4608 final-state alias cases and2688 UBSan input/output overlap cases. Key loads remain interleaved with their output stores; no key snapshot or delayed-store transformation
  • Pool4/4 and five literal arguments across nine functions pass
  • Full43U all_source/report/progress/DOL and worktree/diff checks pass

Partial decompilation gain; no new exact function or Wii execution claim. No headers, tables, compiler settings, register forcing, padding, assembly or linking changes.

Base:6619098ea7146df9d7f7f84b7386ee314d679960
Tested tree:723128da7795c785b8112a1a823f5dc9dcb1507c
DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d

No merge performed or requested by this author.

Note

Refactor AES final-round decryption into DECRYPT_FINAL macro

Replaces the SUBSTITUTE_XOR macro with DECRYPT_FINAL, which takes the round key as an extra argument and folds it into the final substitution/XOR expression. AESiDecryptBlock in aes.c now reads key words directly from context->keys instead of a temporary per-round keys pointer.

Macroscope summarized 6a8272d.

## Source reconstruction Recover the target's key-inclusive final XOR tree `(B ^ L) ^ (U ^ (key ^ H))` and direct context-indexed inverse-key transform rows. All operands remain unsigned, table indices unchanged and key expressions occur once. The previously reconstructed algorithms are retained; this is not a new AES implementation. ## Independent parent verification - AESiDecryptBlock: 69.69323% → 72.30677%, 251/251 instructions; raw positional differences 227 → 219 - Unit: 81.09157% → 82.04506%; encryption unchanged - Seven existing exact function streams unchanged; exact code1116 and data2800 preserved - Compared all1027 allocated objects: only AES .text changed, same2752-byte extent; no relocation/non-text changes and no report regressions - Parent independently compiled actual baseline and candidate with UBSan and passed2406 AES128/192/256 known-answer/randomized CBC cases each, including separate/in-place and single/incremental operation - Worker additionally checked4608 final-state alias cases and2688 UBSan input/output overlap cases. Key loads remain interleaved with their output stores; no key snapshot or delayed-store transformation - Pool4/4 and five literal arguments across nine functions pass - Full43U all_source/report/progress/DOL and worktree/diff checks pass Partial decompilation gain; no new exact function or Wii execution claim. No headers, tables, compiler settings, register forcing, padding, assembly or linking changes. Base:6619098ea7146df9d7f7f84b7386ee314d679960 Tested tree:723128da7795c785b8112a1a823f5dc9dcb1507c DOL SHA1:26116613f624061ba99c8d1a299aaa6efa85670d No merge performed or requested by this author. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Refactor AES final-round decryption into `DECRYPT_FINAL` macro > Replaces the `SUBSTITUTE_XOR` macro with `DECRYPT_FINAL`, which takes the round key as an extra argument and folds it into the final substitution/XOR expression. `AESiDecryptBlock` in [aes.c](https://github.com/coah80/wii-ipl/pull/1020/files#diff-7415b165f7916eb45d6d57b772d27d3eb931d2ce912411adf8b0ad45f3a5fbe9) now reads key words directly from `context->keys` instead of a temporary per-round keys pointer. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 6a8272d.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-03 02:08:22 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.