The whys and hows of secure boot

August 10, 2017

ByteSnap-August 10, 2017

With the proliferation of Internet of Things (IoT) devices, which now span just about every walk of life, from smart cities to wireless jewellery, the need to prioritize security in IoT-style embedded systems has never been greater. The secure boot process is a vital first step in securing any embedded system, a necessary part of your application’s anti-malware fortress. Let’s take a look at the pros and cons, with a focus on one of the most popular processors in electronics – the i.MX6.

What is secure boot?

Secure boot is a process where your OS boot images and code are authenticated against the hardware before they are allowed to be used in the boot process. The hardware is set up beforehand in such a way that it only authenticates code generated using security credentials you trust. In short, it ensures that the boot and OS software is the intended manufacturer version and hasn’t been tampered with by malware or malicious third parties.

Secure boot is applicable for any single-use device, a good example being an e-reader, a popular use of the i.MX6 processor (the i.MX6 Solo and DualLite have an integrated E-Ink display controller, for example), which is intended for specifically reading e-books, rather than general computing. Having a locked-down Linux environment at boot is useful in this case.

Other situations, such as an Android phone, may have trade-offs. Using secure boot would restrict end users from running custom ROMs, for example. Being able to do this may be a feature, or may be desirable based on product placement or security requirements. Essentially, a good time to use secure boot is any case where you don’t want another party to load an operating system or a different bootloader onto your device.

For more integrated systems such as IP cameras running Linux, you would be well advised to use secure boot, as any malicious boot code or operating system software could lead to a situation where the device is made part of a botnet. Or potentially the feed from the camera could be publicly uploaded onto the Internet or otherwise altered so that the feed does not contain the footage wanted by the owner.

Secure boot process on the i.MX6

On the i.MX6, once you have created your boot images, in order to utilize secure boot you would generate a set of secure keys against an SSL certificate generated for this purpose.

These keys are used in the generation of a secure set of commands which are compiled and appended to the boot image using vendor (Freescale, now NXP) -supplied tools. The processor will then take your first stage bootloader and authenticate the certificate data generated by the secure boot compilation tools using your certificates.

If the key data in your boot image that’s written to your boot media matches the key data stored in the secure storage in the processor, the secure commands will be executed, which will then check a cryptographic hash of your images to make sure they match what the secure commands say they should be. If they do match, the processor will load and execute your boot image.

Once this process has passed through the CPU's internal bootloader, you can still call into the secure boot library from your bootloader code. This allows you to load your operating system image and authenticate it in the same way that the CPU bootloader authenticates your software bootloader.

At the end of this process, the OS has booted in a verified secure environment. You know that it’s legitimate because every stage has passed the test of being authenticated against the key hashes that are in the processor.

One-time programmable

Underlying this process from a security perspective, root keys are generated from your SSL certificate, hashed, and burned into the CPU in a one-time programmable process.  Once that key has been burned into the processor, it cannot be changed - one of the reasons it is secure.

Your boot images are also signed against this key and the data generated from this signing process is combined with your image. The processor checks your image key with its key and, if those match, it checks the image against the key that was just matched with the processor.  If that matches, the image is executed. This takes you up the chain, from CPU bootloader to a normal bootloader to the operating system.  

Of course, this is i.MX6 specific and there are different flavors of secure boot, such as X86 with UEFI secure boot, but we’ll stick to i.MX6 for clarity here.

Leveraging the hardware
 
The i.MX6 hardware suite has a number of specific security mechanisms that are of benefit here. The key part of these for secure boot is the one-time fuses used in burning your key. Once they’re blown, they cannot be unblown, so once you’ve burned your key, your key hash is permanent. Multiple keys can be combined into one key hash as well, so you can revoke a key if it has been compromised.

Another function of system security is the CPU internal bootloader, a static piece of code which has also been security tested. This is a key foundation in maintaining a chain of security up to the operating system level.

In addition, the i.MX6 has a hardware cryptographic algorithm accelerator. Algorithms such as AES hashing, Triple DES hashing, SHA1, SHA256, can be accelerated by the processor, which speeds secure operations considerably.

Continue reading on page two >>

 

< Previous
Page 1 of 2
Next >

Loading comments...