openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
ccc_shim.h
Go to the documentation of this file.
1
4#ifndef CCC_SHIM_H
5#define CCC_SHIM_H
6
7#include <stdbool.h>
8#include <stddef.h>
9#include <stdint.h>
10
11#include "ccc_kdf.h"
12
14int ccc_shim_bind(const uint8_t mursk[CCC_MURSK_LEN],
15 const uint8_t salted_hash[CCC_SALTED_HASH_LEN], uint32_t sts_index0,
16 uint16_t n_slot_per_round);
17
19int ccc_shim_bind_from_ursk(const uint8_t ursk[CCC_URSK_LEN], const uint8_t *ranging_config,
20 size_t rc_len, uint32_t sts_index0, uint16_t n_slot_per_round);
21
23void ccc_shim_unbind(void);
24
26bool ccc_shim_active(void);
27
29void ccc_shim_suspend(bool suspend);
30
32int ccc_shim_sts_for_index(uint32_t sts_index, uint8_t dursk[CCC_DURSK_LEN],
33 uint8_t sts_v[CCC_STS_V_LEN]);
34
36int ccc_shim_dudsk_for_index(uint32_t sts_index, uint8_t dudsk[CCC_DUDSK_LEN]);
37
39int ccc_shim_sts_for_slot(uint32_t slot, uint8_t dursk[CCC_DURSK_LEN],
40 uint8_t sts_v[CCC_STS_V_LEN]);
41
43uint32_t ccc_shim_index_from_iv(const uint8_t iv16[16]);
44
47uint32_t ccc_shim_blob_to_ccc_index(uint32_t blob_idx, uint32_t *block, uint32_t *sub);
48
50void ccc_shim_pin_index(uint32_t ccc_index);
51
53void ccc_shim_unpin(void);
54
57
59void ccc_shim_rx_log_reset(void);
60
62void ccc_shim_rx_notify_rx(uint32_t status);
63
65void ccc_shim_rx_try_prepoll(uint16_t datalength);
66
69
77
87
89#define WOZ_CCC_PREPOLL_LISTEN 1
90
92int ccc_prepoll_listen(uint8_t channel, uint8_t preamble_code);
93
96int ccc_prepoll_prewarm(uint8_t channel, uint8_t preamble_code);
97
100void ccc_prepoll_stop(void);
101
103uint32_t ccc_shim_sts_index0(void);
104
105#endif /* CCC_SHIM_H */
UWB ranging key schedule + SP0 frame crypto (CONFIG_WOZ_ALIRO).
#define CCC_DURSK_LEN
dURSK length, bytes (per-cycle STS key material).
Definition ccc_kdf.h:28
#define CCC_URSK_LEN
UWB Ranging Secret Key length, bytes (the schedule's root input).
Definition ccc_kdf.h:16
#define CCC_SALTED_HASH_LEN
SaltedHash length, bytes (ranging-configuration integrity value).
Definition ccc_kdf.h:24
#define CCC_DUDSK_LEN
dUDSK length, bytes (per-cycle timestamp-frame key).
Definition ccc_kdf.h:30
#define CCC_STS_V_LEN
STS-V length, bytes (phyHrpUwbStsV, the DW3000 STS_IV).
Definition ccc_kdf.h:32
#define CCC_MURSK_LEN
mURSK length, bytes (ranging-key seed feeding URSK_KT).
Definition ccc_kdf.h:22
bool ccc_shim_active(void)
Whether the per-frame STS interception is live (bound AND not suspended).
Definition ccc_shim.c:102
void ccc_shim_pin_index(uint32_t ccc_index)
Pin the substituted STS to one fixed CCC index (bench validation).
Definition ccc_shim.c:271
void ccc_shim_suspend(bool suspend)
Suspend/resume the per-frame IV wrap without unbinding.
Definition ccc_shim.c:117
void ccc_prepoll_stop(void)
Stop the Pre-POLL listener: close the self-rearm listen-gate, then force the radio off (target only).
Definition ccc_shim_rx.c:1687
bool ccc_shim_rx_awaiting_final(void)
True while an SP3 Final RX is armed.
Definition ccc_shim_rx.c:302
int ccc_prepoll_listen(uint8_t channel, uint8_t preamble_code)
BENCH: bring up a raw continuous SP0 receiver for the CCC Pre-POLL (target only).
Definition ccc_shim_rx.c:1645
int ccc_prepoll_prewarm(uint8_t channel, uint8_t preamble_code)
Pre-apply the expected session PHY (radio configured, TRX off, RX not armed) so a following ccc_prepo...
Definition ccc_shim_rx.c:1637
uint32_t ccc_shim_blob_to_ccc_index(uint32_t blob_idx, uint32_t *block, uint32_t *sub)
Map the blob's raw provisioned STS index to a CCC-schedule STS index (origin/stride auto-calibrated f...
Definition ccc_shim.c:225
int ccc_shim_dudsk_for_index(uint32_t sts_index, uint8_t dudsk[CCC_DUDSK_LEN])
Derive the dUDSK (per-cycle Final_Data key) for the ranging cycle containing sts_index.
Definition ccc_shim.c:169
void ccc_shim_rx_log_reset(void)
Reset the responder-RX wrap's first-N-arm log budget (target only).
Definition ccc_shim_rx.c:245
void ccc_shim_unpin(void)
Release the debug pin; STS resumes advancing with the blob index.
Definition ccc_shim.c:277
void ccc_shim_unbind(void)
Unbind the shim; ccc_shim_active returns false afterward.
Definition ccc_shim.c:97
bool ccc_shim_rx_awaiting_poll(void)
True while an SP3 POLL RX is armed (the next RX-good event is its result).
Definition ccc_shim_rx.c:285
int 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)
Bind the shim to a ranging session's derived key material.
Definition ccc_shim.c:50
void ccc_shim_rx_notify_rx(uint32_t status)
Feed each RX event's status word to the empirical STS-index tracker (target only).
Definition ccc_shim_rx.c:313
bool ccc_shim_rx_deadline_pending(void)
True while the responder still owes the current ranging block a radio event: an armed POLL RX (a few ...
Definition ccc_shim_rx.c:294
void ccc_shim_rx_try_prepoll(uint16_t datalength)
Decode a received SP0 Pre-POLL frame to read Apple's exact POLL STS index (target only).
Definition ccc_shim_rx.c:709
int ccc_shim_sts_for_slot(uint32_t slot, uint8_t dursk[CCC_DURSK_LEN], uint8_t sts_v[CCC_STS_V_LEN])
Map a ranging-slot offset (STS_Index0 + slot) to its CCC dURSK + STS-V.
Definition ccc_shim.c:195
int 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)
Bind the shim, deriving mURSK + SaltedHash from the URSK + RangingConfiguration.
Definition ccc_shim.c:76
void ccc_shim_wrap_log_reset(void)
Reset the wrap's first-N-frame IV log budget (target only).
Definition ccc_shim_wrap.c:41
int ccc_shim_sts_for_index(uint32_t sts_index, uint8_t dursk[CCC_DURSK_LEN], uint8_t sts_v[CCC_STS_V_LEN])
Map a per-frame STS index to its CCC dURSK (per-cycle) + STS-V (per-PPDU).
Definition ccc_shim.c:129
uint32_t ccc_shim_sts_index0(void)
The bound session's STS_Index0 (for UAD/Pre-POLL derivation); 0 if unbound.
Definition ccc_shim.c:108
uint32_t ccc_shim_index_from_iv(const uint8_t iv16[16])
Extract the STS index the blob packed into a DW3000 STS IV (index at bytes 7..4).
Definition ccc_shim.c:210