An 12900
An 12900
Contents
1 Introduction 1 Introduction......................................1
2 Overview......................................... 1
Over-the-Air (OTA) updates are an efficient way for OEMs to update any
3 Setup............................................... 8
software on the devices that are programmed and operational in the field. By
4 Usage.............................................. 8
performing OTA updates, the software quality and the lifetime of the devices in 5 Conclusion.....................................10
the field increases. 6 Revision history............................. 11
This document provides a prototype implementation for Secure OTA for Linux
images, specifically for NXP devices (in this case i.MX 8M/MM families) using Cryptographic Acceleration and Assurance Module
(CAAM) accelerator and Mender or SWUpdate.
Its purpose is to perform U-Boot, rootfs, and software application updates.
1.2 References
• i.MX 8MM Security Reference Manual
• Mender documentation
• Secure boot
• SWUpdate documentation
2 Overview
The first solution described in this document is based on Mender, a fully robust and secure client-server open source project
for updating IoT devices. On top of Mender, we have integrated the Manufacturing Protection mechanism for a device – server
authentication and U-Boot update feature.
Secondly, we used SWUpdate for upgrading the system. SWUpdate is an open source framework, highly configurable that is
focused on updating an embedded system.
All the patches, deep dive steps, and suggested changes can be found in Setup.
The purpose of this system implementation can be summed up by the following main properties:
• Reliability
— The update does not impact the current working of the device
— The update does not fail the device
• Authentication
— The initial handshake messages are signed with the valid/reliable keys
— The server can authenticate the chip to see if it is NXP legitimate
• Authorization
NXP Semiconductors
Overview
— The server can check if the chip has the right authorization to request updates and it is running the right security
configuration settings
• Confidentiality
— The keys and the OTA update package are encrypted
— The keys are kept encrypted using red blobs
2.1 Mender
Mender is an open-source project for updating embedded Linux devices (IoT). Mender is based on client-server architecture.
The server is using the microservices design pattern, which is multiple small and isolated services that make up the server. The
Docker Compose environment brings all these components up and connects them to store and control the deployment of software
updates OTA to the device (client). Mender’s Web User Interface (UI) or REST APIs can be used for device management and also
for uploading and deploying updates. Mender client runs on the device and periodically checks for updates. If a software update
is available for that device, the client downloads and installs it.
The Mender client is compatible with Yocto Linux and the integration with i.MX 8M family is already available on the Mender
project website.
The main properties of Mender are:
• Roll-back if the update fails
• Atomic updates (no partial install)
• Compatibility check (verifies if the artifact was created for that device type)
• The authenticity of update images (update signature verification)
• Persistent data storage
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 2 / 12
NXP Semiconductors
Overview
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 3 / 12
NXP Semiconductors
Overview
For signing and verifying artifacts, use a key pair. The private key is used for signing the Mender Artifact must be protected and
kept outside of the build system. The public key which is used by the Mender Client to verify the signed Artifact must be included
in the Mender Client build.
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 4 / 12
NXP Semiconductors
Overview
2.2 SWUpdate
SWUpdate is an open source project that can be used for updating an embedded device. It is highly configurable and, as
mentioned in the documentation, it is considered to be a framework.
The installation of the update can be performed from local storage (for example, USB, SD), remote (Hawkbit server, integrated
Web Server or pulling from remote server), or from command line. Unlike Mender, all the dual rootfs logic, rollback and other low
level implementation details need to be created by the user.
The files needed for updating the device together with the metadata about each file are compressed in a CPIO archive
representing the artifact which will be deployed on the device. In the metadata file (sw-description) four important sections may
be defined:
1. images (for example, rootfs image)
2. files
3. scripts (considered being executable; pre- and post- install scripts)
4. bootenv
Also, the update image contains details about hardware compatibility in order to make sure that the update is installed only on
devices having a certain hardware revision and is compatible with the software image. Moreover, the software version can be
verified to skip the installation if it is the same or if the version of new software is older than the version of installed software. For
examples and steps on how to create an update, see the SWUpdate documentation.
From the security perspective, SWUpdate provides support for symmetric key encryption of images as well as for signing and
verifying the signed images using a given public key.
The hash for every image or file that is part of the update image, needs to be added in the metadata file (sw-description). Then,
the sw-description file will be signed. This ensures that the update image will not be tampered.
Two of the most common update strategies provided by SWUpdate are double copy and single copy. In the double copy with
fall-back strategy, the required space is twice as much than in the single copy strategy but it guarantees that there is always a
working copy available. The bootloader is in charge for booting the proper image.
To ease the integration of the SWUpdate project, a meta-swupdate layer is provided and can be added in the Yocto Project.
For more information and examples, see the SWUpdate documentation.
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 5 / 12
NXP Semiconductors
Overview
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 6 / 12
NXP Semiconductors
Overview
The MPPubk is encoded in PEM format and stored in the data partition as a red blob. A blob is a cryptographic data structure
that CAAM uses to protect user-defined data across system power cycles. It provides both confidentiality and integrity protection.
The data to be protected is encrypted so that it can be placed safely in non-volatile storage before the chip is powered down.
Each time the blob protocol is used to protect data and a randomly generated key is used to encrypt the data. The random key is
itself encrypted using key encryption and is then stored along with the encrypted data. The encryption key is derived from the chip
master secret key so the encryption key can be recreated when the chip powers up again. The combination of encrypted key and
encrypted data is called a blob. CAAM blobs differ depending on the data needed to be protected. Red blobs are left unencrypted
when the blob is decapsulated.
As mentioned in Client-server communication, one of the steps performed for client-server authentication is sending and
processing a set of identity attributes. The authentication request sent by the client is signed with the MP Private key, and the
server uses the MP Public key to verify the signature. To verify the signature, instead of having the MP Public key, the server has
to recreate the hash of the authentication set which is a combination of MPMR and the identity attributes.
Reserved (chipNum)
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 7 / 12
NXP Semiconductors
Setup
Reserved (driveType)
Tag
firstSectorNumber
Reserved (sectorCount)
Where:
• The Tag is used as an indication of the valid secondary image table. It must be 0x00112233.
• The firstSectorNumber is the first 512-byte sector number of the secondary image.
For the Closed mode, if there are failures during primary image authentication, the boot ROM turns on the
PERSIST_SECONDARY_BOOT bit and performs the software reset. After the software reset, the secondary image is used.
To update the U-Boot image and recover when the FIT image is corrupted, a customized solution need to be implemented at the
SPL level. In case the HAB authentication for the primary U-Boot fails, load the secondary U-Boot from a known sector number
and if the authentication succeeds, use the secondary U-Boot.
Primary U-Boot:
Secondary U-Boot:
When a U-Boot update is available, ensure that which U-Boot image is active, before updating the primary U-Boot image. If the
primary U-Boot image is running, it has to be copied over to the secondary one. In this way, make sure that a valid version is
available as a secondary U-Boot. If the secondary U-Boot image is loaded, the primary one installed directly. To check which
U-Boot image was loaded, 1 or 2 is written at a certain address in memory at the SPL level and this value is read from user-space.
Another option when receiving a U-Boot update is to always update the primary image and have the secondary U-Boot image at
its initial version, never updated. Therefore, if a U-Boot update is available, the primary one gets updated and if it is corrupted use
the secondary one.
For the current implementation, in case both U-Boot images are corrupted or tampered, the device will not be remotely
usable anymore.
3 Setup
For the setup instructions and to run the demo application see here. For any problems related to Mender client-server
communication, see the troubleshooting section from the Mender project documentation. For any SWUpdate related issue, see
the help and support section from SWUpdate documentation.
4 Usage
After booting the device, it is recommended to verify that the necessary components for the update system are integrated. Key
functionalities include:
• libubootenv is enbaled
• Dual rootfs partition layout
• The kernel is loaded from the expected rootfs
• The rootfs is mounted from the corresponding partition
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 8 / 12
NXP Semiconductors
Usage
The deployments status, as well as the log files, are available in the Mender UI server as shown in the following figure. If an update
is already installed, it can not be reinstalled and the status as already installed. To install an update, the device has to have an
Update Module implemented, as mentioned in Update manager.
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 9 / 12
NXP Semiconductors
Conclusion
Besides the integrated Web Server, the update images can be deployed from Hawkbit server or can be pulled from a remote
server. Further, the SWUpdate framework can be set up to communicate with other back end servers to roll out the update images.
5 Conclusion
In this document, two software update mechanisms for deploying OTA updates on iMX8M are presented. Both solutions, Mender
and SWUpdate, support root file system updates, application level updates, and U-Boot updates. The manufacturing protection
mechanism can be integrated into the client-server authentication process and ensures that the device is a genuine NXP part,
is of a correct part type, has been properly configured via fuses, is running authenticated OEM software, and is currently in the
secure boot.
Table 2 presents some key characteristics for Mender and SWUpdate. Users may decide which update system to use, depending
on the project.
Table 2. Conclusion
Mender Apache-2.0 meta-mender Usable out of Dual-image Signed Not tested yet Web-interface
the box. update images on i.MX8M. and back-end
Relies on solution. delivered as a update
some file archive in system using
assumptions the tarball Docker over
(U-Boot format. HTTPS.
Count Limit,
Linux env
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 10 / 12
NXP Semiconductors
Revision history
tools, and so
on) and
implements
all the
necessary
steps for
setting up the
device. It is a
complete and
robust
solution.
SWUpdate GPL-2.0+ meta- Highly Single copy Signed and Succesfully Pulling from a
swupdate configurable; and double encrypted updated the remote
all the copy with fall- images rootfs and the HTTPS server
necessary back. delivered as a signed kernel. or add a
steps for CPIO archive. custom
setting up the server.
device must
Currently, by
be
default, it
implemented
supports a
by the user.
Hawkbit
Uses Kbuild server.
for
configuration.
6 Revision history
Table 3. Revision history
Secure Over-the-Air Prototype for Linux Using CAAM and Mender or SWUpdate, Rev. 1, 11/2020
Application Note 11 / 12
How To Reach Us Information in this document is provided solely to enable system and software implementers
to use NXP products. There are no express or implied copyright licenses granted hereunder
Home Page:
to design or fabricate any integrated circuits based on the information in this document. NXP
nxp.com reserves the right to make changes without further notice to any products herein.
Web Support: NXP makes no warranty, representation, or guarantee regarding the suitability of its products
nxp.com/support for any particular purpose, nor does NXP assume any liability arising out of the application
or use of any product or circuit, and specifically disclaims any and all liability, including
without limitation consequential or incidental damages. “Typical” parameters that may be
provided in NXP data sheets and/or specifications can and do vary in different applications,
and actual performance may vary over time. All operating parameters, including “typicals,”
must be validated for each customer application by customer's technical experts. NXP does
not convey any license under its patent rights nor the rights of others. NXP sells products
pursuant to standard terms and conditions of sale, which can be found at the following address:
nxp.com/SalesTermsandConditions.
While NXP has implemented advanced security features, all products may be subject to
unidentified vulnerabilities. Customers are responsible for the design and operation of their
applications and products to reduce the effect of these vulnerabilities on customer’s applications
and products, and NXP accepts no liability for any vulnerability that is discovered. Customers
should implement appropriate design and operating safeguards to minimize the risks associated
with their applications and products.
NXP, the NXP logo, NXP SECURE CONNECTIONS FOR A SMARTER WORLD, COOLFLUX,
EMBRACE, GREENCHIP, HITAG, ICODE, JCOP, LIFE VIBES, MIFARE, MIFARE CLASSIC,
MIFARE DESFire, MIFARE PLUS, MIFARE FLEX, MANTIS, MIFARE ULTRALIGHT,
MIFARE4MOBILE, MIGLO, NTAG, ROADLINK, SMARTLX, SMARTMX, STARPLUG, TOPFET,
TRENCHMOS, UCODE, Freescale, the Freescale logo, AltiVec, CodeWarrior, ColdFire,
ColdFire+, the Energy Efficient Solutions logo, Kinetis, Layerscape, MagniV, mobileGT, PEG,
PowerQUICC, Processor Expert, QorIQ, QorIQ Qonverge, SafeAssure, the SafeAssure logo,
StarCore, Symphony, VortiQa, Vybrid, Airfast, BeeKit, BeeStack, CoreNet, Flexis, MXC, Platform
in a Package, QUICC Engine, Tower, TurboLink, EdgeScale, EdgeLock, eIQ, and Immersive3D
are trademarks of NXP B.V. All other product or service names are the property of their
respective owners. AMBA, Arm, Arm7, Arm7TDMI, Arm9, Arm11, Artisan, big.LITTLE, Cordio,
CoreLink, CoreSight, Cortex, DesignStart, DynamIQ, Jazelle, Keil, Mali, Mbed, Mbed Enabled,
NEON, POP, RealView, SecurCore, Socrates, Thumb, TrustZone, ULINK, ULINK2, ULINK-ME,
ULINK-PLUS, ULINKpro, µVision, Versatile are trademarks or registered trademarks of Arm
Limited (or its subsidiaries) in the US and/or elsewhere. The related technology may be protected
by any or all of patents, copyrights, designs and trade secrets. All rights reserved. Oracle
and Java are registered trademarks of Oracle and/or its affiliates. The Power Architecture and
Power.org word marks and the Power and Power.org logos and related marks are trademarks
and service marks licensed by Power.org.