Getting Started with TrustFLEX for Firmware Validation

Please note this page is for Trust Platform Design Suite version 1. Training for Trust Platform Design Suite version 2 can be found here: Trust Platform Design Suite v2.

This page shows you how to validate your firmware (Secure Boot) using TrustFLEX. You will use Jupyter Notebook to configure the TrustFLEX device, then use an example project (from the Trust Platform DesignSuite) to verify the firmware.

TrustFLEX is one of three secure element families in the Trust Platform. It's pre-configured and partially pre-provisioned to support many different security use cases. It also comes with an overwritable generic certificate for TLS-based authentication to a cloud platform.

trustflex_logo.png

The CryptoAuth Trust Platform development kit includes three secure elements: Trust&GO, TrustFLEX, and TrustCUSTOM. This board comes pre-programmed with firmware allowing it to communicate with the Jupyter Notebook application running on your computer. The Trust Platform Python scripts running on Jupyter Notebook take care of the complex provisioning process allowing you to focus your efforts on your end application.

 Materials

Hardware Tools

Tool About Purchase
board-50px.png
CryptoAuth Trust Platform
Evaluation Kit

Software Tools

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
MPLAB® X
Integrated Development Environment
MPLAB® XC32
C/C++ Compiler
swtool-28px.png
Trust Platform DesignSuite
Includes Anaconda Navigator & Jupyter Notebook

MPLAB X IDE v3.35 has a bug that prevents it from connecting to the CryptoAuth Trust Platform board. Please use a previous or later version of the IDE.

1. Device Customization Process

There are five steps involved in customizing the TrustFLEX device:

  1. Select a Pre-defined Use Case(s) from the TrustFLEX use case library.
  2. Generate the development keys and certificates using the Jupyter Notebook resource generator.
  3. Prototype the Use Case(s) in the Jupyter Notebook.
  4. Test the Use Case(s) on an embedded platform using the MPLAB® X IDE projects provided in the suite.
  5. Generate the secret exchange for production.

2. Open Jupyter Notebook

Click the Start Jupyter button to open Jupyter Notebook in your web browser.

This is used to provision a secure element on the CryptoAuth Trust Platform board. See the user guides (in the docs folder) for detailed instructions on running Jupyter Notebook for each use case.

start_jupyter.png
Click image to enlarge.

Jupyter Notebook is an open-source web application that allows you to create documents that contain code and narrative text that can be executed in place. It provides Graphical User Interface (GUI) elements, the ability to add images, and gives the interactive look that is absent in normal code files.

The cells of the Jupyter Notebook can be used to write code or text using markdown. The code cells contain executable code and the text cells contain the explanation of the code's functionality.

assets folder:

  • CryptoAuth Trust Platform board firmware.
  • WINC1500 board firmware.

docs folder:

  • Data sheets.
  • CryptoAuth Trust Platform board user's guide.
  • Detailed use-case guides.

TrustFLEX folder:

  • Jupyter notebook packages
  • C-based projects

TrustnGO folder:

  • Jupyter notebook packages
  • C-based projects
jupyter.png
Click image to enlarge.

3. TrustFLEX Resource Generator:

The Resource Generator Notebook supports the development of Cryptographic Keys, Custom Root, and Signer Keys to issue device certificates and prototype the TrustFLEX devices with development keys and certificates.

TrustFLEX devices come with pre-programmed certificates in slots 10, 11, and 12. Slots zero through four have pre-generated private keys, other than these mentioned slots all the other slots have no data in them.

The Resource Generator Notebook will create development keys and certificates for all slots that can be further customized. Keys and certificate chains are stored in the PC filesystem and not generated in a secure environment.

Note: This tool is used for development purposes only and not for mass production. The keys and certificate chains are not generated in a secure environment.

3.1 Setting up the Hardware:

  • Plug-in the CryptoAuth Trust Platform to the PC using the USB cable.
  • The Design Suite is set up such that it communicates with the TrustFLEX device only.

3.2 Using the Trust Platform Suite for TrustFLEX:

  • Open Jupyter Notebook, navigate to the TrustFLEX resource generator notebook, and click to open it.
    • Trust Platform repository folder: TrustFLEX\00_resource_generation\
    • File: TFLXTLS_resource_generator.ipynb
trustflex3.png
trustflex4.png
Crypto Resource Generator
  • Execute each cell by clicking Cell > Run Cell, and observe the output to ensure each cell is executed successfully.
  • If the Notebook has already been executed before, then restart the kernel by selecting Kernel > Restart and Clear Output.

Some cells take a bit of time to execute. The circle in the images below indicates if the kernel is still working on a cell (full circle) or idle (empty circle).

kernel.png
trustflex5.png
This is a brief guide for the Jupyter interface.
  • Once all the cells are executed, you are asked to select the certificate type you need.
    • Select MCHP Cert to use the standard Microchip certificate.
    • Select Custom Cert to use a custom certificate. If using a custom certificate, you will need to enter the organization name to include in the custom certificates being generated.
  • For this example, select Custom Cert.
    • A prompt will open asking you to enter the Organization Name. If you don't know the organization name you can make one up but make sure the name does not exceed 24 characters.
trustflex5a.png

TrustFLEX devices only use custom certificates for the custom PKI use cases. For all other TrustFLEX use cases, this selection is irrelevant because they don't use certificates.

  • Once the organization name has been entered, the following output and a manifest file to be uploaded into the public cloud of your choice (Google GCP, AWS IoT, and Microsoft Azure) will be generated.

4. Use Case Prototyping:

This hands-on lab will show you how to use the TrustFLEX device and asymmetric authentication to validate the firmware on your MCU.

To validate the firmware, you will need to perform the following steps:

  1. Generate a firmware signing key pair
  2. Sign the firmware
  3. Update the firmware to product
  4. Verify the firmware image

You will need to perform the first 2 steps above in a secure environment. To have firmware validation functionality, once the firmware implementation is completed it should be signed by the OEM firmware signer to make the image authentic. Typically, OEM firmware signer’s public key will be loaded to the secure element and locked permanently.

On the product side, the digest and signature generated in the previous step will be provided to the secure element using the Secure boot command. The Secure boot command will be executed on the secure element with the option to store (Full Copy) on successful validation of the digest and signature.

On the TrustFLEX device, Secure boot configuration is set as “FullDig,” which stores the firmware digest on the device (slot 7 on TrustFLEX). On subsequent boots, the digest is compared without ECC verify operations. While sending the digest to the TrustFLEX device, the digest is encrypted with an IO protection key to avoid man-in-the-middle attacks.

This lab is set up in such a way that firmware sign operation taken care of by notebook, update and verify operations can be done both in Notebook and embedded project. Firmware sign operations are NOT done in embedded project as it’s the role of OEM but not the product.

The resource generation for TrustFLEX device will load:

  1. A prototyping firmware signing key
  2. A prototyping IO protection key to Slot6
  3. Signers public key to Slot15 respectively

The following sections provide detailed steps to execute the Usecase both on Jupyter Notebook and on the embedded project.

4.1 Running the firmware validation example using Jupyter Notebook:

  • From the launched Jupyter Notebook navigate to TFLXTLS_Use_Cases > notebooks > secureboot
trustflex11.png
  • Execute all the steps until 2.3.3, and once it is successfully executed, the SBoot Update button will appear. Click on the button and it will turn green or red based on the result.
trustflex12.png
  • Continue running the example to the end of the notebook, you will see an SBoot Verify button. Click on the button. If it turns green, it is successful.
trustflex13.png
  • Once all the steps are successfully executed, proceed to the next step (open the example project in the MPLAB X IDE).

4.2 Program the CryptoAuth Trust Platform with the Secure Boot example project.

Make sure you have installed both the MPLAB X IDE and XC32 C compiler.

  • Launch MPLAB and open the example project by selecting File > Open Project.
  • Browse to the folder to which you downloaded the Trust Platform Design Suite. You will find the Secure Boot example project in this folder:TFLXTLS_Use_Cases\c\firmware\
  • Select the TFLXTLS_example_SAMD21.X file, then click the Open Project button.
trustflex14.png
  • Double-click on the secureboot_verify.c file to open it and see the code responsible for verifying the firmware.
trustflex15.png
  • Program the CryptoAuth Trust Platform with the Secure Boot example project by right-clicking the project name in the projects window and selecting Make and Program Device.
trustflex16.png
  • The output window shows the progress of the make and program process. You will know the process is complete when you see the "Programming Complete" message.
trustflex17.png
  • Once the programming is complete, the firmware will execute the Secure Boot operation. On successful completion of the operation, the Trust Platform status LED will start blinking.
    • Secure Boot Successful = LED blinks once every second
    • Secure Boot Unsuccessful = LED blinks five times every second
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.