31#define ALIRO_READER_ID_LEN 32u
32#define ALIRO_READER_PRIV_LEN 32u
33#define ALIRO_CRED_PUB_LEN 65u
46#define ALIRO_TRUST_MAX 6u
47#define ALIRO_GRK_LEN 16u
48#define ALIRO_KPERSISTENT_LEN 32u
55struct aliro_reader_identity {
56 uint8_t reader_id[ALIRO_READER_ID_LEN];
57 uint8_t sign_priv[ALIRO_READER_PRIV_LEN];
58 uint8_t grk[ALIRO_GRK_LEN];
68struct aliro_trust_store {
70 uint8_t cred_pub[ALIRO_TRUST_MAX][ALIRO_CRED_PUB_LEN];
74 uint8_t kpersistent[ALIRO_TRUST_MAX][ALIRO_KPERSISTENT_LEN];
80#define ALIRO_PROV_BLOB_HDR 6u
81#define ALIRO_PROV_BLOB_MAX \
82 (ALIRO_PROV_BLOB_HDR + ALIRO_READER_ID_LEN + ALIRO_READER_PRIV_LEN + ALIRO_GRK_LEN + 1u + \
83 (size_t)ALIRO_TRUST_MAX * ALIRO_CRED_PUB_LEN + 1u + \
84 (size_t)ALIRO_TRUST_MAX * ALIRO_KPERSISTENT_LEN)
89void aliro_prov_dev_default(
struct aliro_reader_identity *
id,
struct aliro_trust_store *ts);
93int aliro_prov_serialize(
const struct aliro_reader_identity *
id,
const struct aliro_trust_store *ts,
94 uint8_t *out,
size_t cap,
size_t *out_len);
98int aliro_prov_deserialize(
const uint8_t *buf,
size_t len,
struct aliro_reader_identity *
id,
99 struct aliro_trust_store *ts);
105int aliro_prov_trust_check(
const struct aliro_trust_store *ts,
106 const uint8_t cred_pub[ALIRO_CRED_PUB_LEN]);
110int aliro_prov_trust_add(
struct aliro_trust_store *ts,
const uint8_t cred_pub[ALIRO_CRED_PUB_LEN]);
113int aliro_prov_trust_find(
const struct aliro_trust_store *ts,
114 const uint8_t cred_pub[ALIRO_CRED_PUB_LEN]);
119int aliro_prov_kpersistent_set(
struct aliro_trust_store *ts,
int idx,
120 const uint8_t kp[ALIRO_KPERSISTENT_LEN]);
129int aliro_prov_load(
struct aliro_reader_identity *
id,
struct aliro_trust_store *ts);
132int aliro_prov_store(
const struct aliro_reader_identity *
id,
const struct aliro_trust_store *ts);
147int aliro_prov_erase(
void);