Getting cryptography right isn’t easy, and it’s a lot worse on constrained devices like microcontrollers. RAM is usually the bottleneck — you will smash your stack computing a SHA-2 hash on an AVR — but other resources like computing power and flash code storage space are also at a premium. Trimming down a standard algorithm to work within these constraints opens up the Pandora’s box of implementation-specific flaws.
NIST stepped up to the plate, starting a lightweight cryptography project in 2013 which has now come out with a first report, and here it is as a PDF. The project is ongoing, so don’t expect a how-to guide. Indeed, most of the report is a description of the problems with crypto on small devices. Given the state of IoT security, just defining the problem is a huge contribution.
Still, there are some concrete recommendations. Here are some spoilers. For encryption, they recommend a trimmed-down version of AES-128, which is a well-tested block cipher on the big machines. For message authentication, they’re happy with Galois/Counter Mode and AES-128.
I was most interested in hashing, and came away disappointed; the conclusion is that the SHA-2 and SHA-3 families simply require too much state (and RAM) and they make no recommendation, leaving you to pick among less-known functions: check out PHOTON or SPONGENT, and they’re still being actively researched.
If you think small-device security is easy, read through the 22-question checklist that starts on page twelve. And if you’re looking for a good starting point to read up on the state of the art, the bibliography is extensive.
Your tax dollars at work. Thanks, NIST!
And thanks [acs] for the tip!
If you’re looking for a simple way to make an RF transmitter, check out [Tomasz]’s Morse code transmitter. His design uses nothing more than a microcontroller and a 16MHz crystal to transmit CW Morse code on 96MHz. We’ve seen some similar designs that work at lower frequencies, but transmitting up at 96MHz is pretty impressive.
[Tomasz] used an STM32L microcontroller for this project, which isn’t specced to run up at the high frequencies he wanted to transmit at. To get around this, [Tomasz] wired a 16Mhz oscillator up to microcontroller’s clock input. The clock input is run into the micro’s PLL which is capable of generating high frequencies. He mentions that you can use the internal oscillator instead of a crystal, but it has a ton of phase noise and splatters all over the spectrum.
[Tomasz] chose to start transmitting at 96MHz, which can be picked up by a standard FM radio. To generate this frequency, he set the PLL to multiply the 16MHz crystal up to 192MHz followed by a clock divide of 2 which brings it down to 96MHz. The microcontroller’s CPU runs on the 16MHz crystal input before it goes into the PLL. Next [Tomasz] enabled the MCO clock output pin which routes the 96MHz signal to the outside world.
Transmitting CW is pretty simple; it just involves turning a fixed-frequency transmitter on and off. [Tomasz] wrote a function that enables and disables the MCO output pin. This has the effect of keying any Morse code string you throw at it. Check out the video after the break to see the transmitter in action.
Continue reading “Morse Code RF Transmitter from a Micro’s Clock Output”
AVR microcontrollers can do pretty much anything nowadays. Blinking LEDs, handling sensor inputs, engine control modules, and now, thanks to [Dan], a small single chip BASIC computer with only ten parts (and four of them are capacitors).
[Dan]’s homebrew computer has it all. The ATmega 1284P microcontroller outputs a composite video signal and handles inputs from a PS/2 keyboard. The microcontroller runs at 16 MHz, has 7 kB of memory for programs, and can use a separate EEPROM to store data. It also has an array of GPIO pins for interacting with the physical world.
For software, the microcontroller runs a version of BASIC called Tiny BASIC plus, which is a stripped-down language that can fit in 3 kB of memory. This is crucial if you’re in the 1970s or if you’re programming on an AVR microcontroller in the 21st century.
We’ve seen other Arduinos and AVR-type microcontrollers that can run BASIC, but this one has a great form factor and clean look. It’s also a great way to get familiar with homebrew computing and the BASIC programming language!
I was starting to wonder when [Bruce] would send in this years final projects from the Electrical and Computer Engineering students at Cornell University. The first project looks like a great one for the green geek – a controllable power usage monitoring power outlet. The music geeks should dig midi trumpet interface, but the car geeks might have problems keeping away from the soldering iron after they see the CAN bus SD card data acquisition system. There are plenty more, so go check em out.