Libtropic API
SDK for the TROPIC01 secure element
Version: master (latest)
Loading...
Searching...
No Matches
1. Libtropic API

Expected to be used by an application. More...

Files

file  libtropic.h
 Libtropic library main API header file.
 

Macros

#define TR01_L2_GET_INFO_CHIP_ID_SIZE   128
 Maximal size of returned CHIP ID.
 
#define TR01_MUTABLE_FW_UPDATE_SIZE_MAX   30720
 Maximal size of update data.
 

Functions

lt_ret_t lt_init (lt_handle_t *h)
 Initialize handle and transport layer.
 
lt_ret_t lt_deinit (lt_handle_t *h)
 Deinitialize handle and transport layer.
 
lt_ret_t lt_get_tr01_mode (lt_handle_t *h, lt_tr01_mode_t *mode)
 Gets current mode (Libtropic defined, see lt_tr01_mode_t) of TROPIC01.
 
lt_ret_t lt_get_info_cert_store (lt_handle_t *h, struct lt_cert_store_t *store)
 Read out PKI chain from TROPIC01's Certificate Store.
 
lt_ret_t lt_get_st_pub (const struct lt_cert_store_t *store, uint8_t *stpub)
 Extracts ST_Pub from TROPIC01's Certificate Store.
 
lt_ret_t lt_get_info_chip_id (lt_handle_t *h, struct lt_chip_id_t *chip_id)
 Read TROPIC01's CHIP ID.
 
lt_ret_t lt_get_info_riscv_fw_ver (lt_handle_t *h, uint8_t *ver)
 Read TROPIC01's RISC-V firmware version.
 
lt_ret_t lt_get_info_spect_fw_ver (lt_handle_t *h, uint8_t *ver)
 Read TROPIC01's SPECT firmware version.
 
lt_ret_t lt_get_info_fw_bank (lt_handle_t *h, const lt_bank_id_t bank_id, uint8_t *header, const uint16_t header_max_size, uint16_t *header_read_size)
 Read TROPIC01's firmware bank info.
 
lt_ret_t lt_session_start (lt_handle_t *h, const uint8_t *stpub, const lt_pkey_index_t pkey_index, const uint8_t *shipriv, const uint8_t *shipub)
 Establishes encrypted secure session between TROPIC01 and host MCU.
 
lt_ret_t lt_session_abort (lt_handle_t *h)
 Aborts encrypted secure session between TROPIC01 and host MCU.
 
lt_ret_t lt_sleep (lt_handle_t *h, const uint8_t sleep_kind)
 Puts TROPIC01 into sleep.
 
lt_ret_t lt_reboot (lt_handle_t *h, const lt_startup_id_t startup_id)
 Reboots TROPIC01.
 
lt_ret_t lt_mutable_fw_update (lt_handle_t *h, const uint8_t *update_request)
 Sends mutable firmware update L2 request to TROPIC01 with silicon revision ACAB.
 
lt_ret_t lt_mutable_fw_update_data (lt_handle_t *h, const uint8_t *update_data, const uint16_t update_data_size)
 Sends mutable firmware update data to TROPIC01 with silicon revision ACAB. Function lt_mutable_fw_update() must be called first to start authenticated mutable fw update.
 
lt_ret_t lt_get_log_req (lt_handle_t *h, uint8_t *log_msg, const uint16_t log_msg_max_size, uint16_t *log_msg_read_size)
 Gets Log message of TROPIC01's RISC-V FW (if enabled/available).
 
lt_ret_t lt_ping (lt_handle_t *h, const uint8_t *msg_out, uint8_t *msg_in, const uint16_t msg_len)
 A dummy command to check the Secure Channel Session communication by exchanging a message with TROPIC01, whish is echoed through the Secure Channel.
 
lt_ret_t lt_pairing_key_write (lt_handle_t *h, const uint8_t *pairing_pub, const uint8_t slot)
 Writes pairing public key into TROPIC01's pairing key slot 0-3.
 
lt_ret_t lt_pairing_key_read (lt_handle_t *h, uint8_t *pairing_pub, const uint8_t slot)
 Reads pairing public key from TROPIC01's pairing key slot 0-3.
 
lt_ret_t lt_pairing_key_invalidate (lt_handle_t *h, const uint8_t slot)
 Invalidates pairing key in slot 0-3.
 
lt_ret_t lt_r_config_write (lt_handle_t *h, const enum lt_config_obj_addr_t addr, const uint32_t obj)
 Writes configuration object specified by addr
 
lt_ret_t lt_r_config_read (lt_handle_t *h, const enum lt_config_obj_addr_t addr, uint32_t *obj)
 Reads configuration object specified by addr
 
lt_ret_t lt_r_config_erase (lt_handle_t *h)
 Erases all configuration objects.
 
lt_ret_t lt_i_config_write (lt_handle_t *h, const enum lt_config_obj_addr_t addr, const uint8_t bit_index)
 Writes configuration object specified by addr to I-Config.
 
lt_ret_t lt_i_config_read (lt_handle_t *h, const enum lt_config_obj_addr_t addr, uint32_t *obj)
 Reads configuration object specified by addr from I-Config.
 
lt_ret_t lt_r_mem_data_write (lt_handle_t *h, const uint16_t udata_slot, const uint8_t *data, const uint16_t data_size)
 Writes bytes into a given slot of the User Partition in the R memory.
 
lt_ret_t lt_r_mem_data_read (lt_handle_t *h, const uint16_t udata_slot, uint8_t *data, const uint16_t data_max_size, uint16_t *data_read_size)
 Reads bytes from a given slot of the User Partition in the R memory.
 
lt_ret_t lt_r_mem_data_erase (lt_handle_t *h, const uint16_t udata_slot)
 Erases the given slot of the User Partition in the R memory.
 
lt_ret_t lt_random_value_get (lt_handle_t *h, uint8_t *rnd_bytes, const uint16_t rnd_bytes_cnt)
 Gets random bytes from TROPIC01's Random Number Generator.
 
lt_ret_t lt_ecc_key_generate (lt_handle_t *h, const lt_ecc_slot_t slot, const lt_ecc_curve_type_t curve)
 Generates ECC key in the specified ECC key slot.
 
lt_ret_t lt_ecc_key_store (lt_handle_t *h, const lt_ecc_slot_t slot, const lt_ecc_curve_type_t curve, const uint8_t *key)
 Stores ECC key to the specified ECC key slot.
 
lt_ret_t lt_ecc_key_read (lt_handle_t *h, const lt_ecc_slot_t ecc_slot, uint8_t *key, const uint8_t key_max_size, lt_ecc_curve_type_t *curve, lt_ecc_key_origin_t *origin)
 Reads ECC public key corresponding to a private key in the specified ECC key slot.
 
lt_ret_t lt_ecc_key_erase (lt_handle_t *h, const lt_ecc_slot_t ecc_slot)
 Erases ECC key from the specified ECC key slot.
 
lt_ret_t lt_ecc_ecdsa_sign (lt_handle_t *h, const lt_ecc_slot_t ecc_slot, const uint8_t *msg, const uint32_t msg_len, uint8_t *rs)
 Performs ECDSA sign of a message with a private ECC key stored in TROPIC01.
 
lt_ret_t lt_ecc_eddsa_sign (lt_handle_t *h, const lt_ecc_slot_t ecc_slot, const uint8_t *msg, const uint16_t msg_len, uint8_t *rs)
 Performs EdDSA sign of a message with a private ECC key stored in TROPIC01.
 
lt_ret_t lt_mcounter_init (lt_handle_t *h, const enum lt_mcounter_index_t mcounter_index, const uint32_t mcounter_value)
 Initializes monotonic counter of a given index.
 
lt_ret_t lt_mcounter_update (lt_handle_t *h, const enum lt_mcounter_index_t mcounter_index)
 Updates monotonic counter of a given index.
 
lt_ret_t lt_mcounter_get (lt_handle_t *h, const enum lt_mcounter_index_t mcounter_index, uint32_t *mcounter_value)
 Gets a value of a monotonic counter of a given index.
 
lt_ret_t lt_mac_and_destroy (lt_handle_t *h, const lt_mac_and_destroy_slot_t slot, const uint8_t *data_out, uint8_t *data_in)
 Executes the MAC-and-Destroy sequence.
 

Detailed Description

Dear users, please use this API. It contains all functions you need to interface with TROPIC01 device.