Skip to content

key server: enable R1 content-template hook in MyRelease builds - #64

Merged
WorldObservationLog merged 1 commit into
mainfrom
worktree-keyserver-release
Aug 15, 2026
Merged

key server: enable R1 content-template hook in MyRelease builds#64
WorldObservationLog merged 1 commit into
mainfrom
worktree-keyserver-release

Conversation

@WorldObservationLog

Copy link
Copy Markdown
Owner

What

The 40020 key server's content decryption template (ctx/state/rcx/rax/rdx/r9/rbp) — the "三件套" the pure-Python offline decryptor (decryption/src/decrypt_tool.py --content-server) needs to decrypt any new track fully offline — was gated behind #ifndef MyRelease. So MyRelease builds started the key server but only returned contentKey, and the offline decryptor could not work in Release mode.

Changes

  • main.c — move the R1 hook (Dobby instrument at libCoreLSKD+0x1d5709) and the handle_key_request template-capture block out of the #ifndef MyRelease guard so both Debug and Release compile them. dobby.h/<link.h> become unconditional includes. The curl/log debug hooks (install_hooks definition + main() call) stay #ifndef MyRelease — Release keeps system libcurl / SSL verification.
  • CMakeLists.txt — add option(MYRELEASE ...) + target_compile_definitions(main PRIVATE MyRelease). Previously the MyRelease define was never set, so the Release flag branch (-Wall -Werror, no curl, no -g) in CMakeLists was dead code; cmake -DMYRELEASE=ON now cleanly produces a Release build. Dobby remains unconditionally linked (R1 hook needed in both modes).

Verification

Built both variants in an isolated worktree (NDK r23b, reused FetchContent cache):

Mode R1 hook (content template) curl/log debug hook main.c -Wall -Werror
Release (-DMYRELEASE=ON) ✓ present ✗ absent ✓ no warnings
Debug (default) ✓ present ✓ present
  • Release: cmake -DMYRELEASE=ON .. && makerootfs/system/bin/main (329 KB), grep -c 'R1 hook installed' = 1, grep -c 'hooked curl_easy_setopt' = 0.
  • Debug: cmake .. && make main → binary contains both R1 hook and curl debug hook strings.

Runtime functional check (needs a valid Apple Music session) not run in this environment:

./wrapper -L user:pass -H 0.0.0.0
curl -s 'http://127.0.0.1:40020/key?adamId=<adamId>'   # Release should return ctx/state/rcx/rax/rdx/r9/rbp

Notes

  • CLAUDE.md (untracked in the main checkout, not in this worktree) still says MyRelease = "no Dobby hooks" — should be updated to: curl/log debug hooks disabled, Dobby R1 key-server hook still enabled.
  • subhook was considered as a Dobby replacement but rejected: it only does function replacement with no RegisterContext in the callback, so it cannot capture the instantaneous registers at the R1 entry and continue the original function.

🤖 Generated with Claude Code

The 40020 key server's content decryption template (ctx/state/registers) was gated behind #ifndef MyRelease, so Release builds only returned contentKey and the offline decryptor could not work. Move the R1 hook (Dobby instrument) and the handle_key_request capture block out of the MyRelease guard so both modes compile them; curl/log debug hooks stay Debug-only.

Also wire up the MYRELEASE CMake option (target_compile_definitions) so 'cmake -DMYRELEASE=ON' cleanly produces a Release build -- previously the MyRelease define was never set, so the Release flag branch in CMakeLists was dead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@WorldObservationLog
WorldObservationLog merged commit 4d83f2f into main Aug 15, 2026
1 check passed
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.

1 participant