ChipWhisperer is the first open-source toolchain for embedded hardware security research including side-channel power analysis and glitching.
Side-channel power analysis refers to a method of breaking implementations of completely secure algorithms such as AES-256. Such capabilities have been known for a long time – the attack was first published in 1998. But even today many consider side-channel attacks exotic, and don’t take them seriously when designing secure systems. That is why Canadian startup NewAE Technology has launched a new project to help inform designers that they need to take these threats seriously, by teaching them how the attacks work!
Recently debuted on Kickstarter, the aptly named ChipWhisperer-Lite is essentially an educational tool, designed to introduce embedded enthusiasts to the area of side-channel power analysis. You may also recall the project from last year’s Hackaday Prize, where it garnered second place accolades.
Side-channel attacks aren’t magic; in fact, it is possible to design systems which are resistant to them. For instance, Atmel has a line of secure processors which would have encryption peripherals which cannot easily be attacked. Another example is the ATAES132 device – again this has resistance against side-channel attacks, so you could be more confident in the security of that device, compared to a generic microcontroller with an AES hardware peripheral (such as the AVR XMEGA). It’s all about managing the risk!
Additionally, the ChipWhisperer-Lite required a high-speed USB interface, and so, the NewAE Technology team turned to the Atmel | SMART SAM3U2C to accomplish this feat.
“While a number of systems are designed around generic interface chips, using a high-speed USB microcontroller gave me a lot more flexibility. In addition the cost of the microcontroller chip was cheaper than the stand-alone interface chip I would have used, so all these benefits came at no penalty to the BOM cost,” writes company co-founder Colin O’Flynn.
This shows the basic connections between the SAM3U2C and the FPGA. The external memory interface on the SAM3U2C is used to simplify data and control transfer to and from the FPGA.
According to O’Flynn, the SAM3U family was selected based on set of criteria:
- High-speed USB 2.0 interface
- External memory interface with programmable timing parameters
- TQFP Package (as he wanted people to be able to build this project themselves)
- Lower cost than standalone interface chip (he had been looking for roughly $3-$4 in a quantity of 1,000)
- ROM-resident USB bootloader (so that people building their own don’t need a programmer, and makes the board unbrickable)
“The external memory interface is actually critical to achieving a simple FPGA interface. This allows me to memory-map sections of the FPGA right into the SAM3U processor memory. If transferring data over USB to the FPGA, I can point the USB code from the Atmel Software Framework (ASF) to the location in the FPGA I want the data to go,” O’Flynn adds. “This means no need to copy the data multiple times between buffers, or use some specialized protocol to transfer data from the microcontroller to the FPGA.”
Beyond that, the SAM3U2C simplifies system management. Meeting USB sleep mode current limits (2.5 mA) means shutting off the FPGA and analog portions of the board. Standalone interface chips provide a ‘SUSPEND’ output which you can use, but having the microcontroller offered much more control, which ChipWhisperer-Lite’s creators were able to use for meeting inrush current limits.
The USB standard has limits on the inrush current; this current occurs when the USB device is plugged in and all the capacitors start charging. To avoid exceeding these currents most boards need a ‘soft-start,’ where power supplies are turned on after some delay (or after the USB device finishes enumerating).
“Putting this in the microcontroller gives me control over that delay if fine-tuning is needed, or even having the option of adding multiple switches or slower ramps using a PWM output,” says O’Flynn.
This shows the switch for the FPGA and analog power supplies. Depending on the total load, an RC filter can be added to slow the turn-on speed of the FETs.
Using the SAM3U2C also provided a nice set of peripherals to use, too. The ChipWhisperer-Lite required a ‘target’ device that the user (i.e. student) programs with their algorithm of interest. For this case, the team selected an XMEGA MCU to serve as a programmable target for the student.
The XMEGA device can easily be programmed with only two wires (PDI), and this is generated by one of the SPI modules in the SAM3U. O’Flynn also used a USART module to communicate with the XMEGA, and finally another SPI module to download configuration data to the FPGA.
“While generic interface chips often have support for serial protocols (such as SPI or USARTs), the problem is they are normally limited in the number of channels offered, or I couldn’t use the serial-interface mode at the same time as high-speed parallel interface mode.”
In addition the details of the protocol (such as the low-level PDI programming protocol for the XMEGA) go into the firmware on the SAM3U2C, simplifying the higher-layer USB interface.
“I find it easier to develop those low-level protocols on an embedded system from within Atmel Studio 6.2, compared to trying to send timing-specific information across the USB bus to be processed by the interface chip! Anytime you can avoid USB debugging is time well spent in my books,” O’Flynn emphasizes. “Using an ASF application example as a starting point for the whole application let me rocket through development, with satisfyingly few moments of pounding my head against the desk figuring out why things weren’t working!”
A final nicety of the design was the ability to use the unique ID programmed into the SAM3U2C as part of the USB device serial number. In other words, the NewAE Technology crew could generate unique serial numbers for each device without requiring any special manufacturing step – every device is loaded with the same binary firmware yet still has a unique serial number. As an end-user, having unique USB serial numbers improves the experience since otherwise Windows will reload the driver when you change the USB port the device is plugged into.
“We’re eliminating the problem for good by making the tools open-source. Because this whole area is an active research area, the tools need to be open-source. This isn’t a case of attempting to seem sexy by adding the word ‘open-source’, but placing something of commercial value into the open-source domain, in the hope it spurs a larger community. This includes hours of tutorials on this area, more than just a few board files and some source code.”
Indeed, this project was devised as a fairly advanced piece of test equipment for well-seasoned Makers, embedded developers and computer engineers. That being said, it is important to note that it is not Arduino-compatible, nor does it work with Raspberry Pi or BeagleBone. However, O’Flynn does reveal that an Arduino-compatible, ATmega328P based target board is in the works. Impressively, ChipWhisperer-Lite also enables users to snap off the ‘target board,’ giving them both a main measurement tool and a target device.
Interested in learning more? You can head over to its official Kickstarter page, where the team is well on its way to achieving its $50,000 goal. Pending all goes to plan, shipment is slated for August 2015.