libtropic
C library for TROPIC01 chip
|
Expected to be used by an application. More...
Files | |
file | libtropic.h |
Libtropic library main API header file. | |
Macros | |
#define | LT_L2_GET_INFO_CHIP_ID_SIZE 128 |
Maximal size of returned CHIP ID. | |
#define | LT_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. More... | |
lt_ret_t | lt_deinit (lt_handle_t *h) |
Deinitialize handle and transport layer. More... | |
lt_ret_t | lt_update_mode (lt_handle_t *h) |
Update mode variable in handle. Reads one byte from SPI, checks CHIP_MODE_STARTUP_bit and updates this information in lt_l2_state_t (part of the handle). More... | |
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. More... | |
lt_ret_t | lt_get_st_pub (const struct lt_cert_store_t *store, uint8_t *stpub, int stpub_len) |
Extracts ST_Pub from TROPIC01's Certificate Store. More... | |
lt_ret_t | lt_get_info_chip_id (lt_handle_t *h, struct lt_chip_id_t *chip_id) |
Read TROPIC01's CHIP ID. More... | |
lt_ret_t | lt_get_info_riscv_fw_ver (lt_handle_t *h, uint8_t *ver) |
Read TROPIC01's RISC-V firmware version. More... | |
lt_ret_t | lt_get_info_spect_fw_ver (lt_handle_t *h, uint8_t *ver) |
Read TROPIC01's SPECT firmware version. More... | |
lt_ret_t | lt_get_info_fw_bank (lt_handle_t *h, const bank_id_t bank_id, uint8_t *header, const uint16_t max_len) |
Read TROPIC01's firmware bank info. More... | |
lt_ret_t | lt_session_start (lt_handle_t *h, const uint8_t *stpub, const pkey_index_t pkey_index, const uint8_t *shipriv, const uint8_t *shipub) |
Establishes encrypted secure session between TROPIC01 and host MCU. More... | |
lt_ret_t | lt_session_abort (lt_handle_t *h) |
Aborts encrypted secure session between TROPIC01 and host MCU. More... | |
lt_ret_t | lt_sleep (lt_handle_t *h, const uint8_t sleep_kind) |
Puts TROPIC01 into sleep. More... | |
lt_ret_t | lt_reboot (lt_handle_t *h, const uint8_t startup_id) |
Reboots TROPIC01. More... | |
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. More... | |
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. More... | |
lt_ret_t | lt_get_log_req (lt_handle_t *h, uint8_t *log_msg, uint16_t *log_msg_len) |
Gets Log message of TROPIC01's RISC-V FW (if enabled/available). More... | |
lt_ret_t | lt_ping (lt_handle_t *h, const uint8_t *msg_out, uint8_t *msg_in, const uint16_t len) |
A dummy command to check the Secure Channel Session communication by exchanging a message with TROPIC01, whish is echoed through the Secure Channel. More... | |
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. More... | |
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. More... | |
lt_ret_t | lt_pairing_key_invalidate (lt_handle_t *h, const uint8_t slot) |
Invalidates pairing key in slot 0-3. More... | |
lt_ret_t | lt_r_config_write (lt_handle_t *h, enum CONFIGURATION_OBJECTS_REGS addr, const uint32_t obj) |
Writes configuration object specified by addr More... | |
lt_ret_t | lt_r_config_read (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, uint32_t *obj) |
Reads configuration object specified by addr More... | |
lt_ret_t | lt_r_config_erase (lt_handle_t *h) |
Erases all configuration objects. More... | |
lt_ret_t | lt_i_config_write (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, const uint8_t bit_index) |
Writes configuration object specified by addr to I-Config. More... | |
lt_ret_t | lt_i_config_read (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, uint32_t *obj) |
Reads configuration object specified by addr from I-Config. More... | |
lt_ret_t | lt_r_mem_data_write (lt_handle_t *h, const uint16_t udata_slot, uint8_t *data, const uint16_t size) |
Writes bytes into a given slot of the User Partition in the R memory. More... | |
lt_ret_t | lt_r_mem_data_read (lt_handle_t *h, const uint16_t udata_slot, uint8_t *data, uint16_t *size) |
Reads bytes from a given slot of the User Partition in the R memory. More... | |
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. More... | |
lt_ret_t | lt_random_value_get (lt_handle_t *h, uint8_t *buff, const uint16_t len) |
Gets random bytes from TROPIC01's Random Number Generator. More... | |
lt_ret_t | lt_ecc_key_generate (lt_handle_t *h, const ecc_slot_t slot, const lt_ecc_curve_type_t curve) |
Generates ECC key in the specified ECC key slot. More... | |
lt_ret_t | lt_ecc_key_store (lt_handle_t *h, const ecc_slot_t slot, const lt_ecc_curve_type_t curve, const uint8_t *key) |
Stores ECC key to the specified ECC key slot. More... | |
lt_ret_t | lt_ecc_key_read (lt_handle_t *h, const ecc_slot_t ecc_slot, uint8_t *key, lt_ecc_curve_type_t *curve, ecc_key_origin_t *origin) |
Reads ECC public key corresponding to a private key in the specified ECC key slot. More... | |
lt_ret_t | lt_ecc_key_erase (lt_handle_t *h, const ecc_slot_t ecc_slot) |
Erases ECC key from the specified ECC key slot. More... | |
lt_ret_t | lt_ecc_ecdsa_sign (lt_handle_t *h, const 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. More... | |
lt_ret_t | lt_ecc_ecdsa_sig_verify (const uint8_t *msg, const uint32_t msg_len, const uint8_t *pubkey, const uint8_t *rs) |
Verifies ECDSA signature. Host side only, does not require TROPIC01. More... | |
lt_ret_t | lt_ecc_eddsa_sign (lt_handle_t *h, const 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. More... | |
lt_ret_t | lt_ecc_eddsa_sig_verify (const uint8_t *msg, const uint16_t msg_len, const uint8_t *pubkey, const uint8_t *rs) |
Verifies EdDSA signature. Host side only, does not require TROPIC01. More... | |
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. More... | |
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. More... | |
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. More... | |
lt_ret_t | lt_mac_and_destroy (lt_handle_t *h, mac_and_destroy_slot_t slot, const uint8_t *data_out, uint8_t *data_in) |
Executes the MAC-and-Destroy sequence. More... | |
Dear users, please use this API. It contains all functions you need to interface with TROPIC01 device.