Hydrabus(HW) provides low level access to swd protocol using the pyHydrabus framework. The POC is to show how an target microcontroller is used to authenticate a host debugger(hydrabus) with asymmetric key cryptography and to enabe debug access. The LPC55S69 and other similar series of devices uses the ARM Authenticated Debug Access Control Specification to authenticate a debugger using a challenge/response mechanism. More details about the authentication scheme can be found in the below links. NXP also provides an easier approach to use the USB port in the development boards to authenticate the debugger using the Secure provisioning framework .
The reason for using a Hydrabus is to understand in deep how the low level SWD protocol accesses happens when a debugger connects to a target MCU. The same can be done usign a low cost FTDI( ex using OpenOCD). Below are the few blogs to get started with SWD Hydrabus or an FTDI. I prefferd the Hydrabus as a SWD debugger over FTDI because of the support in using pyHydrabus module.
- Ubuntu 20.04.3 LTS
- Enable Debug Authentication in the LPC55S69 using the Application note
- Install the requirements text for POC.
pip install -r requirements.txt
- After enabling the Debug authentication in the MCU, copy the "dck_rsa_2048.dc" and "dck_rsa_2048.pem" into the folder where the tool is running.
- Run the tool.
python3 swd_lpc55_debug_auth.py
---------- <-----------------> SWD ---------
- Hydra - -----------------> SCLK - LPC55 -
- Bus - -----------------> GND - MCU -
---------- -----------------> VCC ---------
LPC55S69 MCU provides users to enable/disable debug accesses for field return using an authentication mechanism. The Authentication uses ARM debug specification to implement challenge/response protocol and signing of debug tokens using asymmetric key cryptography. In a nutshell, the debug authentication mechanism works as below,
- Developer enables Debug authentication in the MCU and deploys the device in field.
- In field return, when a the developer wants to debug the MCU, the target MCU sends a random challenge along with device specific constraints to the debugger.
- The debugger prepares a response token signed along with a certficate chain and the challenge value.
- The MCU verifies the signature's in the certificate chain against a root of trust fuse and all the debug permisions set in the certificate.
- If the verification is success, the MCU opens the MEM-AP port access to the debugger in order to debug the device till the next cold reset.