modules/woz_uwb/src/ccc/ccc_shim.c
asxeem/openaliro
Module

ccc_shim.c

CCC STS substitution core (implementation).

modules/woz_uwb/src/ccc/ccc_shim.c14 documented symbols

Overview

CCC STS substitution core (implementation).

depends on ccc_shim.h

API

Fstatic uint32_t ccc_shim_slot_from_sub(uint32_t sub)

modules/woz_uwb/src/ccc/ccc_shim.c:37

Map a blob sub-block offset to a CCC slot (currently pass-through).

sub
Sub-block offset.
returns
CCC slot index.
called by ccc_shim_blob_to_ccc_index

Fint ccc_shim_bind(const uint8_t mursk[CCC_MURSK_LEN], const uint8_t salted_hash[CCC_SALTED_HASH_LEN], uint32_t sts_index0, uint16_t n_slot_per_round)

modules/woz_uwb/src/ccc/ccc_shim.c:50

Bind the shim to a ranging session's derived key material.

mursk
mURSK bytes.
salted_hash
SaltedHash bytes.
sts_index0
Initial STS index for this session.
n_slot_per_round
Slots per ranging cycle.
returns
0 on success; -EINVAL if any input is invalid.
called by ccc_shim_bind_from_ursk

Fint ccc_shim_bind_from_ursk(const uint8_t ursk[CCC_URSK_LEN], const uint8_t *ranging_config, size_t rc_len, uint32_t sts_index0, uint16_t n_slot_per_round)

modules/woz_uwb/src/ccc/ccc_shim.c:76

Bind the shim, deriving mURSK and SaltedHash from URSK and RangingConfiguration.

ursk
256-bit URSK input key.
ranging_config
Serialized ranging configuration bytes (may be NULL if rc_len is 0).
rc_len
Length of ranging_config in bytes.
sts_index0
Initial STS index for this session.
n_slot_per_round
Slots per ranging cycle.
returns
0 on success; propagated error from derivation otherwise.
calls ccc_shim_bind

Fvoid ccc_shim_unbind(void)

modules/woz_uwb/src/ccc/ccc_shim.c:97

Unbind the shim; @ref ccc_shim_active returns false afterward.

Fbool ccc_shim_active(void)

modules/woz_uwb/src/ccc/ccc_shim.c:102

Whether the per-frame STS interception is live (bound AND not suspended).

Fuint32_t ccc_shim_sts_index0(void)

modules/woz_uwb/src/ccc/ccc_shim.c:108

The bound session's STS_Index0 (for UAD/Pre-POLL derivation); 0 if unbound.

Fvoid ccc_shim_suspend(bool suspend)

modules/woz_uwb/src/ccc/ccc_shim.c:117

Suspend or resume the per-frame IV wrap without unbinding.

suspend
True to suspend, false to resume.

Fint ccc_shim_sts_for_index(uint32_t sts_index, uint8_t dursk[CCC_DURSK_LEN], uint8_t sts_v[CCC_STS_V_LEN])

modules/woz_uwb/src/ccc/ccc_shim.c:129

Map a per-frame STS index to its CCC dURSK (per-cycle) and STS-V (per-PPDU).

sts_index
STS index in the ranging schedule.
dursk
Output buffer receiving dURSK.
sts_v
Output buffer receiving STS-V.
returns
0 on success; -EINVAL if shim is not active or output pointers are NULL.
called by ccc_shim_sts_for_slot

Fint ccc_shim_dudsk_for_index(uint32_t sts_index, uint8_t dudsk[CCC_DUDSK_LEN])

modules/woz_uwb/src/ccc/ccc_shim.c:169

Derive dUDSK (per-cycle Final_Data key) for the ranging cycle containing sts_index.

sts_index
STS index in the ranging schedule.
dudsk
Output buffer receiving dUDSK.
returns
0 on success; -EINVAL if shim is not active or dudsk is NULL.

Fint ccc_shim_sts_for_slot(uint32_t slot, uint8_t dursk[CCC_DURSK_LEN], uint8_t sts_v[CCC_STS_V_LEN])

modules/woz_uwb/src/ccc/ccc_shim.c:195

Map a ranging-slot offset (STS_Index0 plus slot) to its CCC dURSK and STS-V.

slot
Slot offset from STS_Index0.
dursk
Output buffer receiving dURSK.
sts_v
Output buffer receiving STS-V.
returns
0 on success; -EINVAL if shim is not active.
calls ccc_shim_sts_for_index

Fuint32_t ccc_shim_index_from_iv(const uint8_t iv16[16])

modules/woz_uwb/src/ccc/ccc_shim.c:210

Extract the STS index from a DW3000 STS IV (index at bytes 7..4).

iv16
16-byte STS IV.
returns
STS index.

Fuint32_t ccc_shim_blob_to_ccc_index(uint32_t blob_idx, uint32_t *block, uint32_t *sub)

modules/woz_uwb/src/ccc/ccc_shim.c:225

Map the blob's raw provisioned STS index to a CCC-schedule STS index, with origin and stride auto-calibrated from the first two indices.

blob_idx
Blob provisioned STS index.
block
Output pointer receiving the ranging-cycle block index (may be NULL).
sub
Output pointer receiving the intra-block sub-offset (may be NULL).
returns
CCC-space STS index.
calls ccc_shim_slot_from_sub

Fvoid ccc_shim_pin_index(uint32_t ccc_index)

modules/woz_uwb/src/ccc/ccc_shim.c:271

Pin the substituted STS to one fixed CCC index (bench validation).

ccc_index
CCC index to pin for all subsequent frames.

Fvoid ccc_shim_unpin(void)

modules/woz_uwb/src/ccc/ccc_shim.c:277

Release the debug pin; STS resumes advancing with the blob index.