Skip to main content

Silicon Labs RPS Image Creation and Conversion Tools

Project description

RPS Image Creation and Conversion Tools

Tests

Create and convert RPS images for Silicon Labs SiWx91x devices in a breeze!

Introduction

SiWx91x devices require application images to be converted into RPS images before they can be flashed to the device. The conversion from an application binary to an RPS image includes prepending a header to the application image. This header adds certain metadata to the application, including version numbers, control flags, size information, as well as other instructions to the device's bootloader.

The rps-create tool can be used to create RPS images from M4 application binaries, including adding security features like encryption and signing. By default, a CRC protects the RPS' integrity, however MIC protection can be used instead.

The rps-convert tool can be used to convert existing unsigned/unencrypted (M4 or NWP) RPS images into signed/encrypted RPS images. Changing into MIC integrity protection is also available.

Requirements

This tool was developed using Python 3.10. Required PyPI packages are:

  • intelhex, for parsing Intel HEX-formatted (.hex) application images
  • pycryptodome, for encryption functionality

Installation

pip install silabs-rps

Usage

Help text along with descriptions of each option can be shown by providing the -h or --help flags.

Create RPS Images

rps-create <output filename> --app <filename> 
        [--map <filename>] [--address <address>] [--app-version <version>] 
        [--fw-info <firmware info>] [--sign <filename>] [--sha <size>] 
        [--encrypt <filename>] [--mic <filename>] [--iv <filename>] 

Available options:

  • <output filename> (required)
    • Name of the output RPS image file
  • --app <filename> (required)
    • Name of the application filename to convert into RPS file. Must be in .bin or .hex format
  • --map <filename> (optional, but recommended if your application is to be placed in PSRAM)
    • Name of the map file (.map) from the compilation of the provided application. Used for determining flash start address
  • --address <address> (required if the application file provided with --app is a .bin file, optional otherwise)
    • Application start address. Both decimal and hexadecimal (prefixed by 0x) values are interpreted
  • --app-version <version number> (optional)
    • Application version number. Both decimal and hexadecimal (prefixed by 0x) values are interpreted
  • --fw-info <firmware info> (optional)
    • Additional version information. Both decimal and hexadecimal (prefixed by 0x) values are interpreted
  • --sign <key filename> (optional)
    • Sign the RPS image using the provided (NIST P-256) private key, and append the signature (72 bytes) to the RPS image. The key must be in .pem or .der format
  • --sha <size> (optional)
    • Use SHA-<size> for signing the RPS image. Supported options are 256 (default), 384, and 512 bits
  • --encrypt <key filename> (optional)
    • Encrypt the application image using AES ECB encryption. Key must be 32 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters)
  • --mic <key filename> (optional)
    • Use MIC (AES CBC-MAC) based integrity check instead of CRC to protect the RPS image. Key must be 32 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters)
  • --iv <iv filename> (optional)
    • Custom initialization vector (IV) for the MIC calculation. IV must be 16 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters). If no IV is provided, the default IV will be used.

Usage Examples

Here follows some examples on how to use rps-create.

Create an RPS Image From a .bin Application Image Using CRC Integrity Protection
rps-create my_rps.rps --app my_app.bin --address 0x08212000
Create an RPS Image From a .hex Application Image Using CRC Integrity Protection

The application start address is encoded in the file, so the --address option must be omitted.

rps-create my_rps.rps --app my_app.hex
Create an RPS Image to be Placed in PSRAM
rps-create my_rps.rps --app my_app.bin --address 0x0A012000 --map my_map.map

Note: The provided .map file must correspond to the provided application.

Create an RPS Image With MIC Integrity Protection
rps-create my_rps.rps --app my_app.hex --mic my_key.txt --iv my_iv.txt

Note: The provided MIC key must match the M4_OTA_KEY stored on the device for the device to be able to verify the MIC.

Create an Encrypted RPS Image
rps-create my_rps.rps --app my_app.hex --encrypt my_key.txt

Note: The provided encryption key must match the M4_OTA_KEY stored on the device for the device to be able decrypt the RPS image.

Create a Signed RPS Image, Using SHA-384 Hashing
rps-create my_rps.rps --app my_app.hex --sign my_private_key.pem --sha 384

Note: The provided private key must match the M4_PUBLIC_KEY stored on the device for the device to be able to verify the signature of the RPS image.

Convert RPS Images

rps-convert <output filename> --rps <filename> 
        [--sign <filename>] [--sha <size>]
        [--encrypt <filename>] 
        [--mic <filename>] [--iv <filename>]

Available options:

  • <output filename> (required)
    • Name of the output RPS image file
  • --rps <filename> (required)
    • Name of the application filename to convert into RPS file. Must be in .bin or .hex format
  • --sign <key filename> (optional)
    • Sign the RPS image using the provided (NIST P-256) private key, and append the signature (72 bytes) to the RPS image. The key must be in .pem or .der format
  • --sha <size> (optional)
    • Use SHA-<size> for signing the RPS image. Supported options are 256 (default), 384, and 512 bits
  • --encrypt <key filename> (optional)
    • Encrypt the application image using AES ECB encryption. Key must be 32 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters)
  • --mic <key filename> (optional)
    • Use MIC (AES CBC-MAC) based integrity check instead of CRC to protect the RPS image. Key must be 32 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters)
  • --iv <iv filename> (optional)
    • Custom initialization vector (IV) for the MIC calculation. IV must be 16 bytes, and must be formatted as .bin or .txt (as a string of hexadecimal characters). If no IV is provided, the default IV will be used.

Usage Examples

Here follows some examples on how to use rps-convert.

Sign RPS Image
rps-convert my_signed_rps.rps --rps my_rps.rps --sign my_key.pem
Encrypt RPS Image
rps-convert my_encrypted_rps.rps --rps my_rps.rps --encrypt my_key.bin
Enable MIC Integrity Protection in RPS Image
rps-convert my_mic_rps.rps --rps my_rps.rps --mic my_key.bin --iv my_iv.bin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

silabs_rps-1.1.0.tar.gz (335.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

silabs_rps-1.1.0-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file silabs_rps-1.1.0.tar.gz.

File metadata

  • Download URL: silabs_rps-1.1.0.tar.gz
  • Upload date:
  • Size: 335.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for silabs_rps-1.1.0.tar.gz
Algorithm Hash digest
SHA256 660dbd2f18339a3e31804aa05e6a70b7472c0b8b748e497ac704e16c9e19ef7c
MD5 b1377f381d4c9a14105feda540d0946e
BLAKE2b-256 d01cb4ca75b1d30aa1fbfc788ead035da929e1310b0d6482461ce28cadd7601a

See more details on using hashes here.

File details

Details for the file silabs_rps-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: silabs_rps-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.17

File hashes

Hashes for silabs_rps-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 928b225b15c30810f01f64b5d89a912e9b13a71dbd519b23c75769a73c76f561
MD5 28d626d489cb2b449caddf683300d7f0
BLAKE2b-256 fee36c24a45f665ce3b6211f5bc4c8fc11e1c4793e1283d2150c8a6ceddbae4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page