FeralAI / GP2040

Gamepad firmware for Raspberry Pi Pico and other RP2040 microcontrollers supporting Nintendo Switch, XInput and DirectInput
https://gp2040.info
MIT License
585 stars 125 forks source link

Authenticated controller support - Ways to support them #64

Open dogtopus opened 2 years ago

dogtopus commented 2 years ago

Pretty much just a table listing how to support controllers with authentications.

Type Passthrough Security chip hijacking Native Notes
PS4 Chip hijacking only works with 3rd party controllers and native requires dumping keys from one's own eligible PS4 controller motherboard.
PS5 May be possible by using a certain overpriced (and reportedly broke after firmware update) UP5 module. Still f**k $**y 🖕
Xbox 360 Secrets seem to be symmetrical but not public. Chip hijacking should be possible but no public known successes.
Xbox One/Series Secrets not public. Plus no one cares about it enough except bootleggers.

Basically the best bet is to implement a passthrough support (wide range of controllers covered and user friendly enough). On RP2040 there's a PIO-based USB PHY that's work in progress. MAX3421E is always available as a second option too.

dogtopus commented 2 years ago

Also for PS4 native auth, it's preferred to use a dedicated core to handle RSA if you want to stay bare metal. Not sure why currently the secondary core is used for LEDs and display while they can be driven with little blocking if the IO to them is async (no bitbang, DMA preferred) and the display isn't doing full screen animations. Just noticed that this is intentional. Then it would be preferred to have an RTOS with SMP support (i.e. FreeRTOS) and correctly set the core affinity for the authenticator thread. Another (technically more challenging) route is to have a custom RSA/SHA256 implementation that supports some form of co-operative scheduling and run it on the second core along with all the modules.

I'm currently adding support for RP2040 to my own DS4 controller library and will be able to post here for more info and auth algorithm example once I got the details ironed out. Meanwhile I do have a DS4 emulator in Python that has native auth capability so feel free to check the code here.

Update: The algorithm is now finished here. Note that it's only the auth part and not how to do it via USB, etc. as those parts are still WIP. You would also need a working mbedtls port (including RNG) for this to work. It should also be possible to make this work on Pico SDK with little modification but I haven't tried this yet.

jbarket commented 2 years ago

This is absolute gold. Thanks for sharing.

okkdev commented 2 years ago

This is awesome! What needs to be done to get this implemented into GP2040?

TheTrainGoes commented 2 years ago

Hey @dogtopus ,

Wanted to check in and see how progress on this went.

As a note - This project is no longer maintained. Please check out the Community Edition project. The Community Edition issues section can be found here: https://github.com/OpenStickFoundation/GP2040-CE/