decomp: reconstruct AES last-round key cursor #968

Merged
coah80 merged 1 commits from agent/bittle/aes-key-cursor into main 2026-10-02 22:09:20 +00:00
coah80 commented 2026-10-02 22:08:00 +00:00 (Migrated from github.com)

Minimal structural reconstruction

Separates the real key-schedule base from its last-round offset: initialize key to context->keys, then advance by rounds*4. Two added source lines, one removed. Target AESiDecryptBlock +0x18 forms context+0x10, +0x24 extracts the round offset, and +0x28 adds it to that base; independently checked by parent. No algorithm/table/header/link changes and no new correctness bug claimed.

Fresh verification on 3244c6d7

  • Decrypt 249 → 251 instructions, matching target size; fuzzy 61.49004% → 63.836655%.
  • AES unit decompiled/fuzzy 76.844475% → 77.700584%.
  • Existing 7/9 exact APIs, exact code 1116/2752 and data 2800/2800 unchanged. All seven exact APIs also ctxdiff zero; encryption unchanged.
  • Parent reran 2,406 AES-128/192/256 known-answer and seeded CBC comparisons, including in-place and incremental calls. Host endian-adjusted inputs/type shims, not Wii execution.
  • All 1027 allocated objects audited: only AES text changes, 2744 → 2752 bytes; all data and other objects unchanged. No report regressions.
  • Pool 4/4 identical; literal audit 9 functions/5 arguments, no candidates/errors/skips.
  • Full 43U all_source/progress/report/DOL passes SHA1 26116613f624061ba99c8d1a299aaa6efa85670d.
  • Tests 8/36/27/8, worktree and diff checks pass. Remote tree 8852e2b1cf equals tested tree.

No register/volatile forcing, invented instructions or padding. Partial decompilation improvement only; no new exact match or native linking claim. Left for review; no merge performed.

Note

Split AESiDecryptBlock last-round key cursor into two-step init

Changes the key-pointer setup in AESiDecryptBlock from one combined expression to two steps: assign the base key array first, then advance by rounds*4. Decryption rounds, inverse-key transform, and output handling are unchanged. Also adds an engineering log covering the candidate, rejected alternatives, and matching status.

Macroscope summarized ba9f18a.

## Minimal structural reconstruction Separates the real key-schedule base from its last-round offset: initialize key to context->keys, then advance by rounds*4. Two added source lines, one removed. Target AESiDecryptBlock +0x18 forms context+0x10, +0x24 extracts the round offset, and +0x28 adds it to that base; independently checked by parent. No algorithm/table/header/link changes and no new correctness bug claimed. ## Fresh verification on 3244c6d7 - Decrypt 249 → 251 instructions, matching target size; fuzzy 61.49004% → 63.836655%. - AES unit decompiled/fuzzy 76.844475% → 77.700584%. - Existing 7/9 exact APIs, exact code 1116/2752 and data 2800/2800 unchanged. All seven exact APIs also ctxdiff zero; encryption unchanged. - Parent reran 2,406 AES-128/192/256 known-answer and seeded CBC comparisons, including in-place and incremental calls. Host endian-adjusted inputs/type shims, not Wii execution. - All 1027 allocated objects audited: only AES text changes, 2744 → 2752 bytes; all data and other objects unchanged. No report regressions. - Pool 4/4 identical; literal audit 9 functions/5 arguments, no candidates/errors/skips. - Full 43U all_source/progress/report/DOL passes SHA1 26116613f624061ba99c8d1a299aaa6efa85670d. - Tests 8/36/27/8, worktree and diff checks pass. Remote tree 8852e2b1cfbecfd03f1bc5037cb6d011dbf396dc equals tested tree. No register/volatile forcing, invented instructions or padding. Partial decompilation improvement only; no new exact match or native linking claim. Left for review; no merge performed. <!-- 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] > ### Split `AESiDecryptBlock` last-round key cursor into two-step init > Changes the key-pointer setup in `AESiDecryptBlock` from one combined expression to two steps: assign the base key array first, then advance by `rounds*4`. Decryption rounds, inverse-key transform, and output handling are unchanged. Also adds an engineering log covering the candidate, rejected alternatives, and matching status. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized ba9f18a.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-02 22:09:18 +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.