modules/woz_aliro/include/aliro_assert.h
openaliro/openaliro
Module
aliro_assert.h
used by aliro_assert_ec.h aliro_assert.c
API
Cstruct aliro_assert
modules/woz_aliro/include/aliro_assert.h:115
The assertion fields. Wire layout (big-endian multi-byte), the tag covers every byte before it: magic(2)=A1 50 | version(1)=03 | alg(1) | status(1) | nonce(16) | cred_id(8) | distance_cm(2) | range_flags(1) | sts_quality(2) | trust_level(1) | uptime_ms(8) | unix_ms(8) | sig(64) = 115 bytes. The three integrity fields sit next to distance_cm because they qualify it: reading the distance without them is reading a number with its provenance stripped off.
##define ALIRO_ASSERT_NONCE_LEN 16u
modules/woz_aliro/include/aliro_assert.h:58
##define ALIRO_ASSERT_CREDID_LEN 8u
modules/woz_aliro/include/aliro_assert.h:59
##define ALIRO_ASSERT_SIG_LEN 64u
modules/woz_aliro/include/aliro_assert.h:60
##define ALIRO_ASSERT_PUB_LEN 65u
modules/woz_aliro/include/aliro_assert.h:61
##define ALIRO_ASSERT_SIGNED_LEN 51u
modules/woz_aliro/include/aliro_assert.h:64
##define ALIRO_ASSERT_WIRE_P256 (ALIRO_ASSERT_SIGNED_LEN + ALIRO_ASSERT_SIG_LEN)
modules/woz_aliro/include/aliro_assert.h:65
##define ALIRO_ASSERT_WIRE_MAX ALIRO_ASSERT_WIRE_P256
modules/woz_aliro/include/aliro_assert.h:66
##define ALIRO_ASSERT_DIST_NONE 0xFFFFu
modules/woz_aliro/include/aliro_assert.h:68
##define ALIRO_ASSERT_TIME_NONE 0u
modules/woz_aliro/include/aliro_assert.h:69
##define ALIRO_ASSERT_RANGE_STS_OK 0x01u
modules/woz_aliro/include/aliro_assert.h:84
##define ALIRO_ASSERT_RANGE_FLAGS_KNOWN 0x01u
modules/woz_aliro/include/aliro_assert.h:85
Cenum aliro_assert_alg
modules/woz_aliro/include/aliro_assert.h:90
Cenum aliro_assert_status
modules/woz_aliro/include/aliro_assert.h:98
Cenum aliro_assert_verdict
modules/woz_aliro/include/aliro_assert.h:129
Fsize_t aliro_assert_wire_len(uint8_t alg)
modules/woz_aliro/include/aliro_assert.h:146
Fuint8_t aliro_assert_peek_alg(const uint8_t *buf, size_t len)
modules/woz_aliro/include/aliro_assert.h:150
Fvoid aliro_assert_cred_id(const uint8_t cred_pub[ALIRO_ASSERT_PUB_LEN], uint8_t cred_id[ALIRO_ASSERT_CREDID_LEN])
modules/woz_aliro/include/aliro_assert.h:155
Ctypedef int (*aliro_assert_sign_fn)(void *ctx, const uint8_t *msg, size_t msg_len, uint8_t sig[ALIRO_ASSERT_SIG_LEN])
modules/woz_aliro/include/aliro_assert.h:172
Ctypedef int (*aliro_assert_verify_fn)(void *ctx, const uint8_t *msg, size_t msg_len, const uint8_t sig[ALIRO_ASSERT_SIG_LEN])
modules/woz_aliro/include/aliro_assert.h:174
Fint aliro_assert_build_p256(aliro_assert_sign_fn sign, void *ctx, const struct aliro_assert *a, uint8_t *wire, size_t wire_cap, size_t *wire_len)
modules/woz_aliro/include/aliro_assert.h:180
Fint aliro_assert_verify_p256(aliro_assert_verify_fn verify, void *ctx, const uint8_t *wire, size_t wire_len, const uint8_t expected_nonce[ALIRO_ASSERT_NONCE_LEN], const uint8_t expected_cred_id[ALIRO_ASSERT_CREDID_LEN], uint16_t threshold_cm, uint64_t min_uptime_ms, struct aliro_assert *out)
modules/woz_aliro/include/aliro_assert.h:204