|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <TropicSlotMap.h>
Classes | |
| struct | SlotRange |
Public Types | |
| enum class | SlotType : uint8_t { ECC , RMEM } |
| using | RangeCallback = void (*)(const SlotRange& range, void* user) |
Public Member Functions | |
| bool | isValid () const |
| const char * | errorMessage () const |
| bool | getRangeByName (const char *moduleName, SlotType type, SlotRange *out) const |
| Retrieves slot range by module name and slot type. | |
| bool | getRangeByModuleId (uint8_t moduleId, SlotType type, SlotRange *out) const |
| Retrieves slot range by module id and slot type. | |
| bool | isRmemAllowedForModuleId (uint16_t slot, uint8_t moduleId) const |
| Checks whether RMEM slot is allowed for given module id. | |
| void | forEachRange (SlotType type, RangeCallback cb, void *user) const |
| Iterates configured slot ranges of the given type in declaration order. | |
| uint16_t | rmemMax () const |
| Returns maximum RMEM slot index. | |
| uint32_t | computeMapSignature () const |
| Computes deterministic signature over static map constants and ranges. | |
Static Public Member Functions | |
| static TropicSlotMap & | instance () |
| Returns singleton Tropic slot-map instance. | |
Definition at line 7 of file TropicSlotMap.h.
| using cdc::core::TropicSlotMap::RangeCallback = void (*)(const SlotRange& range, void* user) |
Definition at line 32 of file TropicSlotMap.h.
|
strong |
| Enumerator | |
|---|---|
| ECC | |
| RMEM | |
Definition at line 9 of file TropicSlotMap.h.
| uint32_t cdc::core::TropicSlotMap::computeMapSignature | ( | ) | const |
Computes deterministic signature over static map constants and ranges.
Definition at line 227 of file TropicSlotMap.cpp.
References cdc::tropic_map::ECC_SLOT_MAX, cdc::tropic_map::ECC_SLOT_MIN, cdc::tropic_map::ECC_SLOT_RESERVED, cdc::core::hash::FNV1A_32_OFFSET_BASIS, cdc::core::hash::fnv1a_mix_u32(), cdc::core::kSlotMap, cdc::core::kSlotMapCount, cdc::tropic_map::RMEM_SLOT_MAX, cdc::tropic_map::RMEM_SLOT_MIN, cdc::tropic_map::RMEM_SLOT_MIN_ALLOC, and cdc::tropic_map::RMEM_SLOT_RESERVED.
|
inline |
Definition at line 26 of file TropicSlotMap.h.
Referenced by cdc::ui::ui_init().
| void cdc::core::TropicSlotMap::forEachRange | ( | SlotType | type, |
| RangeCallback | cb, | ||
| void * | user ) const |
Iterates configured slot ranges of the given type in declaration order.
Definition at line 185 of file TropicSlotMap.cpp.
References cdc::core::TropicSlotMap::SlotRange::end, cdc::core::kSlotMap, cdc::core::kSlotMapCount, cdc::core::TropicSlotMap::SlotRange::moduleId, cdc::core::TropicSlotMap::SlotRange::moduleName, cdc::core::TropicSlotMap::SlotRange::start, cdc::core::TropicSlotMap::SlotRange::type, and cdc::core::TropicSlotMap::SlotRange::valid.
Referenced by cdc::serial::cmdTr01Slots().
| bool cdc::core::TropicSlotMap::getRangeByModuleId | ( | uint8_t | moduleId, |
| SlotType | type, | ||
| SlotRange * | out ) const |
Retrieves slot range by module id and slot type.
| moduleId | Module identifier. |
| type | Slot type. |
| out | Output range descriptor. |
Definition at line 165 of file TropicSlotMap.cpp.
References cdc::core::TropicSlotMap::SlotRange::end, cdc::core::kSlotMap, cdc::core::kSlotMapCount, cdc::core::TropicSlotMap::SlotRange::moduleId, moduleId, cdc::core::TropicSlotMap::SlotRange::moduleName, cdc::core::TropicSlotMap::SlotRange::start, cdc::core::TropicSlotMap::SlotRange::type, and cdc::core::TropicSlotMap::SlotRange::valid.
Referenced by isRmemAllowedForModuleId().
| bool cdc::core::TropicSlotMap::getRangeByName | ( | const char * | moduleName, |
| SlotType | type, | ||
| SlotRange * | out ) const |
Retrieves slot range by module name and slot type.
| moduleName | Module map name. |
| type | Slot type. |
| out | Output range descriptor. |
Definition at line 141 of file TropicSlotMap.cpp.
References cdc::core::TropicSlotMap::SlotRange::end, cdc::core::kSlotMap, cdc::core::kSlotMapCount, cdc::core::TropicSlotMap::SlotRange::moduleId, cdc::core::TropicSlotMap::SlotRange::moduleName, cdc::core::TropicSlotMap::SlotRange::start, cdc::core::TropicSlotMap::SlotRange::type, and cdc::core::TropicSlotMap::SlotRange::valid.
|
static |
Returns singleton Tropic slot-map instance.
Definition at line 37 of file TropicSlotMap.cpp.
Referenced by cdc::core::TropicStorage::cleanup(), cdc::serial::cmdTr01Slots(), cdc::core::TropicStorage::forEachSlot(), cdc::core::TropicStorage::getSlot(), cdc::core::TropicStorage::rebuildVerbose(), and cdc::ui::ui_init().
| bool cdc::core::TropicSlotMap::isRmemAllowedForModuleId | ( | uint16_t | slot, |
| uint8_t | moduleId ) const |
Checks whether RMEM slot is allowed for given module id.
| slot | RMEM slot. |
| moduleId | Module identifier. |
Definition at line 207 of file TropicSlotMap.cpp.
References cdc::core::TropicSlotMap::SlotRange::end, getRangeByModuleId(), moduleId, RMEM, and cdc::core::TropicSlotMap::SlotRange::start.
|
inline |
Definition at line 25 of file TropicSlotMap.h.
| uint16_t cdc::core::TropicSlotMap::rmemMax | ( | ) | const |
Returns maximum RMEM slot index.
Definition at line 219 of file TropicSlotMap.cpp.
References cdc::tropic_map::RMEM_SLOT_MAX.
Referenced by cdc::core::TropicStorage::cleanup(), and cdc::core::TropicStorage::rebuildVerbose().