CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
Tropic01Element.cpp File Reference

TROPIC01 secure-element HAL implementation with session-managed libtropic access. More...

#include "cdc_hal/ISecureElement.h"
#include "cdc_hal/libtropic_port_esp32.h"
#include "cdc_hal/hw_config.h"
#include "cdc_hal/pairing_key_config.h"
#include "cdc_core/SystemLock.h"
#include "cdc_spi_lock.h"
#include "cdc_log.h"
#include "esp_random.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/spi_master.h"
#include "psa/crypto.h"
#include <atomic>
#include <cstring>
#include "libtropic.h"
#include "libtropic_common.h"
#include "libtropic_l2.h"
#include "libtropic_l3.h"
#include "libtropic_port.h"
#include "lt_l2_api_structs.h"
#include "libtropic_mbedtls_v4.h"

Go to the source code of this file.

Classes

class  cdc::hal::Tropic01Element
 Secure-element implementation backed by libtropic. More...

Namespaces

namespace  cdc
namespace  cdc::hal

Functions

ISecureElementcdc::hal::getSecureElementInstance ()
 Returns singleton secure-element stub instance.

Variables

static const char * TAG = "TR01"
 libtropic headers (already guarded for C/C++ linkage).
static constexpr uint8_t RMEM_HEADER_MAGIC = 0xCD
static Tropic01Element cdc::hal::g_secureElement
 Global singleton instance of TROPIC secure-element implementation.

Detailed Description

TROPIC01 secure-element HAL implementation with session-managed libtropic access.

Synchronization model:

  • The shared SPI bus (display + TROPIC01) is the single serialization point. Every public method acquires device_.spi via spi_device_acquire_bus for the entire duration of its libtropic interaction and releases it on exit. The libtropic port layer does NOT acquire the bus per frame, so a multi-frame libtropic operation is atomic with respect to other SPI users (display, future SPI peripherals) and other tasks.
  • Internal _unlocked variants assume the caller already holds the bus and never re-acquire.
  • On detection of LT_L1_CHIP_ALARM_MODE the global SystemLock is latched and the system enters deep-sleep lockdown from the main loop.

Definition in file Tropic01Element.cpp.

Variable Documentation

◆ RMEM_HEADER_MAGIC

uint8_t RMEM_HEADER_MAGIC = 0xCD
staticconstexpr

Definition at line 44 of file Tropic01Element.cpp.

Referenced by cdc::hal::Tropic01Element::rmemWriteWithHeader().

◆ TAG

const char* TAG = "TR01"
static

libtropic headers (already guarded for C/C++ linkage).

Definition at line 43 of file Tropic01Element.cpp.