Skip to content

Commit 15f4b3c

Browse files
authored
Merge pull request #309 from tropicsquare/develop
Prepare for release 2.0.1
2 parents f68c834 + 6700820 commit 15f4b3c

File tree

14 files changed

+289
-129
lines changed

14 files changed

+289
-129
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.0.1]
9+
10+
### Added
11+
- Mentioned compatibility of libtropic 2.0.0 and 2.0.1 with FW 1.0.0 and Bootloader v2.0.1 in the main README.md compatibility table.
12+
- Row in the compatibility table for libtropic 2.0.1.
13+
- Section about TROPIC01 firmware in the documentation.
14+
15+
### Fixed
16+
- Handling of `add` argument in the Mac-And-Destroy example (`lt_ex_macandd.c`): `NULL` can be passed, `memcpy()` will not be called with `NULL` argument and no additional data will be used in the M&D sequence.
17+
- Set newest available FW version in CMakeLists.txt.
18+
- CMakeLists.txt: use `set()` for string options, enhance validating of their values
19+
820
## [2.0.0]
921

1022
### Changed

CMakeLists.txt

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ cmake_minimum_required(VERSION 3.21.0)
88

99
include(cmake/strict_compile_flags.cmake)
1010

11-
option(LT_CRYPTO "Set a cryptography provider" OFF)
12-
option(LT_BUILD_DOCS "Build documentation" OFF)
1311
option(LT_BUILD_EXAMPLES "Compile example code as part of libtropic library" OFF)
1412
option(LT_BUILD_TESTS "Compile functional tests' code as part of libtropic library" OFF)
1513
# This switch controls if helper utilities are compiled in. In most cases this should be ON,
@@ -23,8 +21,38 @@ option(LT_SEPARATE_L3_BUFF "Define L3 buffer separately out of the handle" OFF)
2321
option(LT_PRINT_SPI_DATA "Print SPI communication to console, used to debug low level communication" OFF)
2422
option(LT_STRICT_COMP_FLAGS "Enable strict compilation flags for libtropic" OFF)
2523
option(LT_ASAN "Enable AddressSanitizer (ASan)" OFF)
24+
25+
# TROPIC01 silicon revision: useful for firmware update and functional tests
26+
# (as some behavior) differ between revisions.
27+
set(LT_SILICON_REV "ACAB" CACHE STRING "Set TROPIC01 silicon revision")
28+
set_property(CACHE LT_SILICON_REV PROPERTY STRINGS "ABAB" "ACAB")
29+
30+
# Used for compiling the correct FW update files
31+
# Available versions can be seen in the compatibility table in the main README.md.
32+
# Always use bundled versions from "TROPIC01_fw_update_files" folder!
33+
set(LT_CPU_FW_VERSION "1_0_1" CACHE STRING "Set TROPIC01 FW version")
34+
set_property(CACHE LT_CPU_FW_VERSION PROPERTY STRINGS "1_0_0" "1_0_1")
35+
# Validate specified version
36+
get_property(lt_cpu_fw_version_choices CACHE LT_CPU_FW_VERSION PROPERTY STRINGS)
37+
set(cpu_fw_valid FALSE)
38+
foreach(cpu_fw_choice IN LISTS lt_cpu_fw_version_choices)
39+
if(LT_CPU_FW_VERSION STREQUAL ${cpu_fw_choice})
40+
set(cpu_fw_valid TRUE)
41+
break()
42+
endif()
43+
endforeach()
44+
if (NOT cpu_fw_valid)
45+
message(FATAL_ERROR "Invalid TROPIC01 FW version: '${LT_CPU_FW_VERSION}'\nAvailable FW versions: ${lt_cpu_fw_version_choices}")
46+
endif()
47+
48+
# Crypto provider
49+
set(LT_CRYPTO "" CACHE STRING "Set a cryptography provider")
50+
# set_property(CACHE LT_CRYPTO PROPERTY STRINGS "trezor_crypto" "mbedtls") # uncomment this after mbedtls is ready
51+
set_property(CACHE LT_CRYPTO PROPERTY STRINGS "trezor_crypto") # delete this after mbedtls is ready
52+
2653
# Logging options
27-
option(LT_LOG_LVL "Set log level" OFF)
54+
set(LT_LOG_LVL "" CACHE STRING "Set log level")
55+
set_property(CACHE LT_LOG_LVL PROPERTY STRINGS "None" "Error" "Warning" "Info" "Debug")
2856

2957
# Use INFO logging level when building tests/examples
3058
if(LT_BUILD_TESTS OR LT_BUILD_EXAMPLES)
@@ -74,7 +102,8 @@ elseif(LT_LOG_LVL STREQUAL "None")
74102
elseif(NOT LT_LOG_LVL)
75103
message(STATUS "No logging level specified, defaulting to NONE (logging is disabled)")
76104
else()
77-
message(WARNING "Incorrect logging level specified: '${LT_LOG_LVL}'. Defaulting to NONE!")
105+
get_property(lt_log_lvl_choices CACHE LT_LOG_LVL PROPERTY STRINGS)
106+
message(FATAL_ERROR "Incorrect logging level specified: '${LT_LOG_LVL}'\nAvailable logging levels: ${lt_log_lvl_choices}")
78107
endif()
79108

80109
# Define the ASAN flags here so they are not duplicated.
@@ -100,41 +129,6 @@ set(LT_SH0_PRIV_PATH
100129
# and save result to HAS_PARENT_SCOPE.
101130
get_directory_property(HAS_PARENT_SCOPE PARENT_DIRECTORY)
102131

103-
###########################################################################
104-
# #
105-
# Define silicon revision. Default is ACAB (production chips). #
106-
# Allowed values are: #
107-
# ABAB - Silicon revision B - Bootloader v1.0.1 #
108-
# ACAB - Silicon revision C - Bootloader v2.0.1 #
109-
# #
110-
# Useful for firmware update and functional tests (as some behavior) #
111-
# differ between revisions. #
112-
# #
113-
###########################################################################
114-
115-
if (NOT DEFINED LT_SILICON_REV)
116-
set(LT_SILICON_REV "ACAB")
117-
endif()
118-
119-
###########################################################################
120-
# #
121-
# Define files for firmware update. #
122-
# #
123-
# For more info about firmware update go into #
124-
# TROPIC01_fw_update_files/README.md #
125-
# #
126-
# [1] Define LT_SILICON_REV -- see above. #
127-
# #
128-
# [2] Define firmware files here, allowed values are: #
129-
# APP: 1_0_0 #
130-
# SPECT: Use version in folder next to application firmware update #
131-
# #
132-
# Always use bundled versions from "TROPIC01_fw_update_files" folder! #
133-
# #
134-
###########################################################################
135-
136-
set(LT_CPU_FW_VERSION "1_0_0")
137-
138132
###########################################################################
139133
# #
140134
# Collect files: #
@@ -216,7 +210,8 @@ if (LT_SILICON_REV STREQUAL "ABAB")
216210
elseif (LT_SILICON_REV STREQUAL "ACAB")
217211
set(BL_FOLDER boot_v_2_0_1)
218212
else()
219-
message(FATAL_ERROR "Invalid silicon revision (LT_SILICON_REV): ${LT_SILICON_REV}")
213+
get_property(lt_silicon_rev_choices CACHE LT_SILICON_REV PROPERTY STRINGS)
214+
message(FATAL_ERROR "Invalid silicon revision: '${LT_SILICON_REV}'\nAvailable silicon revisions: ${lt_silicon_rev_choices}")
220215
endif()
221216

222217
set(SDK_INCS ${SDK_INCS}
@@ -473,10 +468,6 @@ endif()
473468
# #
474469
###########################################################################
475470

476-
# Supported crypto providers
477-
# set(CRYPTO_PROVIDERS "trezor_crypto" "mbedtls") # mbedtls is WIP
478-
set(CRYPTO_PROVIDERS "trezor_crypto")
479-
480471
# These are internal macros for crypto providers
481472
set(LT_CRYPTO_TREZOR 0 CACHE INTERNAL "")
482473
set(LT_CRYPTO_MBEDTLS 0 CACHE INTERNAL "")
@@ -498,8 +489,8 @@ elseif(LT_CRYPTO STREQUAL "mbedtls")
498489

499490
else()
500491

501-
string(REPLACE ";" ", " ALLOWED_PROVIDERS_STR "${CRYPTO_PROVIDERS}")
502-
message(FATAL_ERROR "Incorrect cryptographic provider set to LT_CRYPTO!\nAvailable providers: ${ALLOWED_PROVIDERS_STR}")
492+
get_property(lt_crypto_choices CACHE LT_CRYPTO PROPERTY STRINGS)
493+
message(FATAL_ERROR "Incorrect cryptographic provider set to LT_CRYPTO!\nAvailable providers: ${lt_crypto_choices}")
503494

504495
endif()
505496

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# libtropic
1+
# Libtropic
22

33
![](https://github.com/tropicsquare/libtropic/actions/workflows/integration_tests.yml/badge.svg) ![](https://github.com/tropicsquare/libtropic/actions/workflows/build_docs_master.yml/badge.svg) ![](https://tropic-gitlab.corp.sldev.cz/internal/sw-design/libtropic/badges/master/coverage.svg)
44

@@ -11,18 +11,19 @@ Libtropic documentation is available [here](https://tropicsquare.github.io/libtr
1111

1212
## Compatibility with TROPIC01 firmware versions
1313

14-
For the `libtropic` library to function correctly with the TROPIC01 secure element, the versions of three key components must be compatible:
14+
For the Libtropic library to function correctly with the TROPIC01 secure element, the versions of three key components must be compatible:
1515

16-
1. **`libtropic` SDK**: The version of this library.
16+
1. **Libtropic SDK**: The version of this library.
1717
2. **Application Firmware**: The main firmware running on the TROPIC01 chip.
1818
3. **SPECT Firmware**: The co-processor firmware on the TROPIC01 chip.
1919

2020
The following table outlines the tested and supported compatibility between released versions:
2121

22-
| API document version | `libtropic` | Application | SPECT | Bootloader | Tests |
23-
| :----------------------------------------------------------------------------------------------------: |:-------------------:|:----------------------:|:----------------:| :-------: | :---------------------------------------: |
24-
| [1.3.0](https://github.com/tropicsquare/tropic01/blob/main/doc/api/ODU_TR01_user_api_v1.3.0.pdf) | 1.0.0 | 1.0.0 | 1.0.0 | v1.0.1 | <code style="color : green">Passed</code> |
25-
| [1.3.0](https://github.com/tropicsquare/tropic01/blob/main/doc/api/ODU_TR01_user_api_v1.3.0.pdf) | 1.0.0 | 1.0.0 | 1.0.0 | v2.0.1 | <code style="color : green">Passed</code> |
22+
| Libtropic | Application | SPECT | Bootloader | Tests | API document version |
23+
|:-------------------:|:----------------------:|:----------------:| :-------: | :---------------------------------------: | :----------------------------------------------------------------------------------------------------: |
24+
| 1.0.0 | 1.0.0 | 1.0.0 | v1.0.1 | <code style="color : green">Passed</code> | [1.3.0](https://github.com/tropicsquare/tropic01/blob/main/doc/api/ODU_TR01_user_api_v1.3.0.pdf) |
25+
| 2.0.0 | 1.0.0–1.0.1 | 1.0.0 | v2.0.1 | <code style="color : green">Passed</code> | [1.3.0](https://github.com/tropicsquare/tropic01/blob/main/doc/api/ODU_TR01_user_api_v1.3.0.pdf) |
26+
| 2.0.1 | 1.0.0–1.0.1 | 1.0.0 | v2.0.1 | <code style="color : green">Passed</code> | [1.3.0](https://github.com/tropicsquare/tropic01/blob/main/doc/api/ODU_TR01_user_api_v1.3.0.pdf) |
2627

2728
Using mismatched versions of the components may result in unpredictable behavior or errors. It is strongly advised to use the latest compatible versions of all components to ensure proper functionality.
2829

TROPIC01_fw_update_files/tropic_fw_update_files.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/get_started/examples/irreversible_examples.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ This example explains the firmware update process for both ABAB and ACAB silicon
5252
- How to read the current firmware versions.
5353
- How to update the firmware using `lt_do_mutable_fw_update()`.
5454

55+
!!! tip
56+
For more information about the firmware itself, refer to the [TROPIC01 Firmware](../tropic01_fw.md) section.
57+
5558
??? example "Source code"
5659
```c { .copy }
5760
--8<-- "examples/lt_ex_fw_update.c"

docs/get_started/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ This section provides information to help you get started with libtropic.
44
- [Libtropic Architecture](libtropic_architecture.md)
55
- [Integrating Libtropic](integrating_libtropic/index.md)
66
- [Examples](examples/index.md)
7+
- [TROPIC01 Firmware](tropic01_fw.md)
78
- [Logging](logging.md)
89
- [Debugging](debugging.md)

docs/get_started/tropic01_fw.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# TROPIC01 Firmware
2+
TROPIC01 contains the following FW execution engines:
3+
4+
- **RISC-V CPU**,
5+
- **ECC engine** or **SPECT** (these two terms are used interchangeably).
6+
7+
There are multiple kinds of FW running in TROPIC01:
8+
9+
1. *Immutable FW (bootloader)*. Located in ROM, runs on RISC-V CPU from ROM after power-up, updates or boots the mutable FWs.
10+
2. *RISC-V Mutable FW (CPU FW)*. Updatable, located in R-memory, runs on RISC-V CPU from RAM, processes L2/L3 communication.
11+
3. *ECC engine mutable FW (ECC engine FW)*. Updatable, located in R-memory, runs on ECC engine from RAM, helps the RISC-V CPU FW with processing ECC commands (ECC_Key_*, ECDSA/EDDSA_Sign).
12+
13+
!!! tip
14+
For more detailed information about each FW, refer to the [FW Update Application Note](https://github.com/tropicsquare/tropic01?tab=readme-ov-file#application-notes).
15+
16+
## TROPIC01 Firmware in Libtropic
17+
Libtropic provides not only implementation of the FW update L2 commands, but also the necessary files for updating both the RISC-V and SPECT FW. Refer to:
18+
19+
1. [Firmware Update Files](#firmware-update-files) section for more information about the `TROPIC01_fw_update_files/` directory.
20+
2. [lt_ex_fw_update.c](./examples/irreversible_examples.md#lt_ex_fw_updatec) section (in the [Irreversible Examples](./examples/irreversible_examples.md) documentation page) for a practical example, showing how to update TROPIC01's FW using Libtropic.
21+
22+
### Firmware Update Files
23+
The `TROPIC01_fw_update_files/` directory provides TROPIC01 FW update files in two formats:
24+
25+
1. *C header files (`*.h`)*. These are designed to be included and compiled directly into the Host MCU's firmware/application. See [Compiling into Libtropic](#compiling-into-libtropic) section for more information.
26+
2. *Binary files (`*.bin`)*. These can be stored in the Host MCU, loaded at runtime and used to update TROPIC01's FW.
27+
28+
The general structure of the `TROPIC01_fw_update_files/` directory is the following:
29+
```text
30+
TROPIC01_fw_update_files/
31+
├── boot_v_<X_Y_Z>/
32+
│ └── fw_v_<A_B_C>/
33+
│ ├── fw_CPU.h
34+
│ ├── fw_SPECT.h
35+
│ ├── fw_v<A_B_C>.hex32_signed_chunks.bin
36+
│ └── spect_app-v<D_E_F>_signed_chunks.bin
37+
└── convert.py
38+
```
39+
40+
- `boot_v_<X_Y_Z>/`: directories of available FW update files for a given bootloader version `<X_Y_Z>`.
41+
- `fw_v_<A_B_C>/`: directory with RISC-V CPU and SPECT FW update files (in both formats) for a given FW version `<A_B_C>`. Note that the RISC-V CPU FW and SPECT FW versions can be different.
42+
- `convert.py`: Python script for converting firmware binary files into C header files.
43+
44+
#### Compiling into Libtropic
45+
To select which FW version will be compiled together with Libtropic, the user has to set the following CMake variables (both have a default value):
46+
47+
1. `LT_SILICON_REV`: Defines the TROPIC01 silicon revision (e.g. `"ACAB"`), based on which the correct bootloader version is selected. Refer to the [Available Parts](https://github.com/tropicsquare/tropic01?tab=readme-ov-file#available-parts) section (in the [TROPIC01 GitHub repository](https://github.com/tropicsquare/tropic01)) to find out the silicon revision of your TROPIC01 chip.
48+
2. `LT_CPU_FW_VERSION`: Defines the TROPIC01 FW version (e.g. `"1_0_1"`), based on which the correct FW update files for both RISC-V CPU and SPECT are selected.

0 commit comments

Comments
 (0)