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. | |
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 Read one byte from spi, check CHIP_MODE_STARTUP_bit and update this information in handle.alignas. 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 certificate store. More... | |
lt_ret_t | lt_get_st_pub (const struct lt_cert_store_t *store, uint8_t *stpub, int stpub_len) |
Extract ST_Pub from 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, const uint16_t max_len) |
Read TROPIC01's RISCV firmware version. More... | |
lt_ret_t | lt_get_info_spect_fw_ver (lt_handle_t *h, uint8_t *ver, const uint16_t max_len) |
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 fw 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) |
Establish encrypted session between TROPIC01 and host MCU. More... | |
lt_ret_t | lt_session_abort (lt_handle_t *h) |
Abort encrypted session between TROPIC01 and host MCU. More... | |
lt_ret_t | lt_sleep (lt_handle_t *h, const uint8_t sleep_kind) |
Put TROPIC01 into sleep. More... | |
lt_ret_t | lt_reboot (lt_handle_t *h, const uint8_t startup_id) |
Reboot TROPIC01. More... | |
lt_ret_t | lt_mutable_fw_erase (lt_handle_t *h, bank_id_t bank_id) |
Erase mutable firmware in one of banks. More... | |
lt_ret_t | lt_mutable_fw_update (lt_handle_t *h, const uint8_t *fw_data, const uint16_t fw_data_size, bank_id_t bank_id) |
Update mutable firmware in one of banks. More... | |
lt_ret_t | lt_get_log (lt_handle_t *h, uint8_t *log_msg, uint16_t msg_len_max) |
Get TROPIC01's internal log message (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) |
Test secure session by exchanging a message with chip msg_out of length 'len' is echoed through secure channel. More... | |
lt_ret_t | lt_pairing_key_write (lt_handle_t *h, const uint8_t *pairing_pub, const uint8_t slot) |
Write 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) |
Read 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) |
Invalidate pairing key in slo 0-3. More... | |
lt_ret_t | lt_r_config_write (lt_handle_t *h, enum CONFIGURATION_OBJECTS_REGS addr, const uint32_t obj) |
Write one configuration object. More... | |
lt_ret_t | lt_r_config_read (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, uint32_t *obj) |
Read one configuration object. More... | |
lt_ret_t | lt_r_config_erase (lt_handle_t *h) |
Erase the whole config space. More... | |
lt_ret_t | lt_i_config_write (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, const uint8_t bit_index) |
Write one I config object. More... | |
lt_ret_t | lt_i_config_read (lt_handle_t *h, const enum CONFIGURATION_OBJECTS_REGS addr, uint32_t *obj) |
Read one I config object. 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) |
Write bytes into a given slot of R MEMORY. More... | |
lt_ret_t | lt_r_mem_data_read (lt_handle_t *h, const uint16_t udata_slot, uint8_t *data, const uint16_t size) |
Read bytes from a given slot of R MEMORY. More... | |
lt_ret_t | lt_r_mem_data_erase (lt_handle_t *h, const uint16_t udata_slot) |
Erase bytes from a given slot of R MEMORY. More... | |
lt_ret_t | lt_random_get (lt_handle_t *h, uint8_t *buff, const uint16_t len) |
Get number of random bytes. More... | |
lt_ret_t | lt_ecc_key_generate (lt_handle_t *h, const ecc_slot_t slot, const lt_ecc_curve_type_t curve) |
Generate ECC key in the device's 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) |
Store ECC key in the device's ECC key slot. More... | |
lt_ret_t | lt_ecc_key_read (lt_handle_t *h, const ecc_slot_t ecc_slot, uint8_t *key, const uint8_t keylen, lt_ecc_curve_type_t *curve, ecc_key_origin_t *origin) |
Read ECC public key corresponding to a private key in device's slot. More... | |
lt_ret_t | lt_ecc_key_erase (lt_handle_t *h, const ecc_slot_t ecc_slot) |
Erase ECC key from device's slot. More... | |
lt_ret_t | lt_ecc_ecdsa_sign (lt_handle_t *h, const ecc_slot_t ecc_slot, const uint8_t *msg, const uint16_t msg_len, uint8_t *rs, const uint8_t rs_len) |
ECDSA sign message with a private key stored in TROPIC01 device. 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, const uint8_t rs_len) |
EdDSA sign message with a private key stored in TROPIC01 device. 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) |
EdDSA signature verify, HOST SIDE ONLY, does not require TROPIC01 device. More... | |
lt_ret_t | lt_mcounter_init (lt_handle_t *h, const enum lt_mcounter_index_t mcounter_index, const uint32_t mcounter_value) |
Initialize 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) |
Update 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) |
Get 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) |
Execute the MAC-and-Destroy sequence. More... | |
const char * | lt_ret_verbose (lt_ret_t ret) |
Dear users, please use this API. It contains all functions you need to interface with TROPIC01 device.