openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
aliro_advtag.h
1
// Aliro BLE advertisement Dynamic Tag derivation (Aliro 1.0 section 11.3.1): the 7-byte
2
// GroupResolvingKey-resolvable tag the phone recomputes to identify a reader of interest.
3
/*
4
* Copyright (c) 2026 asxeem
5
* SPDX-License-Identifier: ISC
6
*
7
* aliro_advtag — pure Dynamic Tag derivation, platform-free so the host suite
8
* can pin it against the spec's section 20 worked examples. The BLE transport
9
* (aliro_ble.c) calls this with the live expiry on every (re)advertise.
10
*/
11
#pragma once
12
#include <stdint.h>
13
14
#ifdef __cplusplus
15
extern
"C"
{
16
#endif
17
18
#define ALIRO_ADVTAG_LEN 7u
19
20
/* Advertised expiry when the reader has no wall clock (spec section 11.3);
21
* phones accept this form but then cannot expiry-filter the tag. */
22
#define ALIRO_ADVTAG_EXPIRY_UNAVAILABLE 0xFFFFFFFFu
23
24
/* Derive the Dynamic Tag: the 7 most significant bytes of
25
* AES-128(GRK, 00*6 || AdvA || BE32(expiry)), every field MSB-first.
26
* adva_msb is the advertising address in printed order (c4:bb:86:c3:27:10 ->
27
* {0xc4,..,0x10}); NimBLE's ble_addr_t.val stores it reversed. Returns 0 on
28
* success, negative if the AES backend fails. */
29
int
aliro_advtag_derive(
const
uint8_t grk[16],
const
uint8_t adva_msb[6], uint32_t expiry_unix,
30
uint8_t tag[ALIRO_ADVTAG_LEN]);
31
32
#ifdef __cplusplus
33
}
34
#endif
modules
woz_aliro
include
aliro_advtag.h
Generated by
1.9.8