key server: enable R1 content-template hook in MyRelease builds - #64
Merged
Conversation
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>
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.
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. SoMyReleasebuilds started the key server but only returnedcontentKey, and the offline decryptor could not work in Release mode.Changes
main.c— move the R1 hook (Dobby instrument at libCoreLSKD+0x1d5709) and thehandle_key_requesttemplate-capture block out of the#ifndef MyReleaseguard so both Debug and Release compile them.dobby.h/<link.h>become unconditional includes. The curl/log debug hooks (install_hooksdefinition +main()call) stay#ifndef MyRelease— Release keeps system libcurl / SSL verification.CMakeLists.txt— addoption(MYRELEASE ...)+target_compile_definitions(main PRIVATE MyRelease). Previously theMyReleasedefine was never set, so the Release flag branch (-Wall -Werror, no curl, no-g) in CMakeLists was dead code;cmake -DMYRELEASE=ONnow 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):
-Wall -Werror-DMYRELEASE=ON)cmake -DMYRELEASE=ON .. && make→rootfs/system/bin/main(329 KB),grep -c 'R1 hook installed'= 1,grep -c 'hooked curl_easy_setopt'= 0.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:
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.subhookwas considered as a Dobby replacement but rejected: it only does function replacement with noRegisterContextin the callback, so it cannot capture the instantaneous registers at the R1 entry and continue the original function.🤖 Generated with Claude Code