libtropic
C library for TROPIC01 chip
|
Welcome to the documentation page for libtropic, the official C library for TROPIC01 chip. This guide will help you get started with building applications using TROPIC01 and libtropic.
For detailed information about the libtropic library architecture and development, please refer to the For contributors section.
TROPIC01
is currently available in three forms:
Samples can be requested through our website. Visit tropicsquare.com/tropic01-samples for more info.
PCB modules with TROPIC01 engineering samples
are available as Secure Tropic Click through our external partner MIKROE's webshop.
To order, visit mikroe.com.
You can interface Secure Tropic Click with your platform over SPI bus using a breadboard or wires. Additional conversion PCBs are available on the MIKROE website, including an arduino form factor extension board.
Designed for evaluation on systems where SPI is not available.
Please visit tropicsquare.com, sign-up and check availability.
Check out examples/
folder, it contains a few examples of how libtropic functions might be used.
There is also folder tests/functional/
with code used internally for testing.
Examples or functional tests are not compiled by default. They can be compiled by adding special CMake options, which is discussed further in this text.
To compile examples, either
-DLT_BUILD_EXAMPLES=1
to cmake
during compilation, orset(LT_BUILD_EXAMPLES ON)
.To compile functional tests, either
-DLT_BUILD_TESTS=1
to cmake
during compilation, orset(LT_BUILD_TESTS ON)
.When LT_BUILD_EXAMPLES
or LT_BUILD_TESTS
are set, there has to be a way to define the SH0 private key for the TROPIC01's pairing key slot 0, because both the examples and the tests depend on it. For this purpose, the CMake variable LT_SH0_PRIV_PATH
is used, which should hold the path to the file with the SH0 private key in PEM or DER format. By default, the path is set to the currently used lab batch package, found in ../provisioning_data/<lab_batch_package_directory>/sh0_key_pair/
. But it can be overriden by the user either from the command line when executing CMake (switch -DLT_SH0_PRIV_PATH=<path>
), or from a child CMakeLists.txt
.
For more information about the provisioning_data/
directory structure, see it's README.md.
To see the whole process of executing examples or functional tests against the TROPIC01 model, see README.md in the tropic01_model/
directory.
Our examples and functional tests are platform independent, so they can also be compiled and run in our platform repositories:
Both of these repositories consist of:
CMakeLists.txt
main.c
For more detailed info, refer to the aforementioned platform repositories.
Besides that, we offer the libtropic-util repository, which implements a CLI based utility for executing TROPIC01's commands.
How can you add libtropic to your existing project?
At first please read all chapters in this page so you get familiar with how library works.
Then we recommend to add libtropic as a submodule. Libtropic uses CMake build system, therefore it could be added to compilation of existing CMake projects in a following way:
Exact CMake calls depend on configuration of a project into which libtropic is being added. For more inspiration, have a look at the aforementioned platform repositories.
We offer multiple CMake options - to see all of them, go to the beginning of the CMakeLists.txt
file in the repository's root directory.
In this case you have to add list of all libtropic *.c and *.h files manually to your makefile and then for all CMake ON options (located in libtropic's CMakeFile.txt) you define -D switch in your makefile.
Then do the same for files used in vendor/trezor_crypto/
.