PS4 auth: wire by USB output + web-config key upload#172
Merged
Conversation
The fork wired joypad_add_ps4_local_auth() into joypad_add_btstack(), which is the wrong axis: console-output apps (usb2gc/dc/pce) link BTstack for BT *input* and were paying the mbedTLS cost despite never presenting a PS4 USB device, while native-input USB-output apps (snes2usb, gc2usb, n642usb, …) that don't use BTstack never got PS4 auth at all. Attach it instead to every target that compiles ps4_mode.c (part of USB_DEVICE_SOURCES) — i.e. every USB-gamepad-output app — via a single post-definition loop. New USB-output apps get PS4 auth automatically; tight console-only apps like usb2dc never link mbedTLS. Activation remains runtime- gated on uploaded key material (PS4AUTH.SET).
Adds a PS4 Auth page to the in-repo web config so DS4 local RSA key material can be installed from any USB-output device over CDC — no separate upload tool. - New Ps4AuthCard component: three file inputs (key.prm / serial.txt / sig.bin), client-side RSA-2048 parsing via WebCrypto (extracts N/E/P/Q, verifies P×Q=N), and PS4AUTH.SET / STATUS / CLEAR + PS4LOG.* over the existing CDC protocol. - Nav link is hidden unless the firmware answers PS4AUTH.STATUS, so it only appears on builds that support it. - Reuses the RSA-parsing logic from tools/ps4-auth-upload (kept as reference); the standalone tool is now redundant with the config app. Only N/E/P/Q are transmitted, never the PEM.
RobertDaleSmith
temporarily deployed
to
Web Config
July 11, 2026 22:57 — with
GitHub Actions
Inactive
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.
Follow-up to #171 (DS4 local RSA auth). Two changes that make PS4 auth a
first-class, runtime-selectable option on any USB-output app.
1. Attach PS4 local auth by USB output, not BTstack
The merge wired
joypad_add_ps4_local_auth()intojoypad_add_btstack(), whichis the wrong axis:
paying the mbedTLS cost despite never presenting a PS4 USB device.
BTstack never got PS4 auth at all.
Now it attaches to every target that compiles
ps4_mode.c(part ofUSB_DEVICE_SOURCES) — i.e. every USB-gamepad-output app — via a singlepost-definition loop over
BUILDSYSTEM_TARGETS. New USB-output apps get itautomatically; tight console-only apps like usb2dc never link mbedTLS.
Activation stays runtime-gated on uploaded key material.
2. PS4 auth key upload in the in-repo web config
Instead of the standalone
tools/ps4-auth-uploadpage, key material can now beinstalled from
tools/web-configover CDC, on any device that supports it:Ps4AuthCard: key.prm / serial.txt / sig.bin inputs, client-side RSA-2048parsing via WebCrypto (extracts N/E/P/Q, verifies P×Q=N), and
PS4AUTH.SET/STATUS/CLEAR+PS4LOG.*over the existing CDC protocol.PS4AUTH.STATUS, so it onlyappears on supported builds.
N/E/P/Q are transmitted, never the PEM.
npm run buildverified (vite single-file bundle);dist/rebuilt.Notes
cmd_ps4auth_*handlers are already#ifdef ENABLE_PS4_LOCAL_AUTH-guarded, soENABLE_PS4_LOCAL_AUTH=OFFstill links (handlers become no-ops).builds the PS4 Auth page simply stays hidden.
🤖 Generated with Claude Code