modules/woz_aliro/include/aliro_stepup.h
openaliro/openaliro
Module

aliro_stepup.h

Aliro step-up (Access Document) phase: builds the mdoc DeviceRequest, unwraps and decrypts the…

modules/woz_aliro/include/aliro_stepup.h7 documented symbols

Overview

Aliro step-up (Access Document) phase: builds the mdoc DeviceRequest, unwraps and decrypts the SessionData DeviceResponse, decodes the CBOR document per spec 7.2/8.4.2, and runs the six-step Access Document verification of spec 7.4. Reference-completeness codec + verifier; the verdict is logged and stored, never gates the unlock (the provisioned trust store remains the sole gate).

depends on aliro_crypto.h  ·  used by aliro_reader.c aliro_stepup.c aliro_stepup_parse.c

API

Cstruct aliro_stepup_digest

modules/woz_aliro/include/aliro_stepup.h:96

Step-up credential element digest: SHA-256 hash of a disclosed IssuerSignedItem, with its digest_id for verification.

Cstruct aliro_stepup_item

modules/woz_aliro/include/aliro_stepup.h:105

Single disclosed IssuerSignedItem from a Step-up document: digest_id (which digest to check against), tagged (24(bstr(IssuerSignedItem)) bytes for hashing), elem_id (element name).

Cstruct aliro_stepup_doc

modules/woz_aliro/include/aliro_stepup.h:121

Parsed Step-up access document (ISO/IEC 18013-5 mDoc): have_document (0 if device declined), status (DeviceResponse "3" code), doc_type and name_space (issuer namespace), IssuerAuth COSE_Sign1 components (protected header, kid, x5chain, payload=24(bstr(MSO)), signature r||s), MobileSecurityObject (digest algorithm, doc type, disclosed digests), validity dates (signed/valid_from/valid_until as epoch seconds, with flags), and disclosed IssuerSignedItems (elem_id, tagged bytes, digest_id for matching against MSO).

Cstruct aliro_stepup_issuer

modules/woz_aliro/include/aliro_stepup.h:163

---- verifier (§7.4) ----

Cstruct aliro_stepup_verify_ctx

modules/woz_aliro/include/aliro_stepup.h:174

Context for Step-up document verification: issuers (trust store), time_valid/now_epoch (clock state), access_iteration (stored iteration for replay check), expected_doctype, ecdsa_verify callback (ES256 over message, takes 65-byte pub, message, 64-byte r||s sig, returns 0 on valid).

Cstruct aliro_stepup_verdict

modules/woz_aliro/include/aliro_stepup.h:193

Verdict of Step-up document verification (ISO/IEC 18013-5 §7.4): valid (all passed steps + >=1 valid element), reject_step (0=accepted, else step 1-6 that failed), issuer_key_found/issuer_chain_validated/sig_ok/digests_ok/doctype_ok/time_ok/iteration_ok (per-step flags), valid_elements (count of disclosed items with verified digest).

Cstruct aliro_stepup_job

modules/woz_aliro/include/aliro_stepup.h:228

---- ESP worker seam (implemented per-platform; see aliro_stepup_worker.c) ---- Copies the collected SessionData response + keys + verify inputs and runs aliro_stepup_run() off the BLE-host task, so parse/verify never touches the auth segment or the ranging arm window. Returns 0 if queued.

##define ALIRO_STEPUP_DOCTYPE_ACCESS "aliro-a"

modules/woz_aliro/include/aliro_stepup.h:42

##define ALIRO_STEPUP_DOCTYPE_REVOCATION "aliro-r"

modules/woz_aliro/include/aliro_stepup.h:43

##define ALIRO_STEPUP_SK_OFFSET 64u

modules/woz_aliro/include/aliro_stepup.h:47

Fint aliro_stepup_derive_keys(const uint8_t block[ALIRO_KEY_BLOCK_LEN], uint8_t sk_reader[ALIRO_SESSION_KEY_LEN], uint8_t sk_device[ALIRO_SESSION_KEY_LEN])

modules/woz_aliro/include/aliro_stepup.h:48

Fvoid aliro_stepup_channel_init(struct aliro_secchan *sc, const uint8_t sk_reader[ALIRO_SESSION_KEY_LEN], const uint8_t sk_device[ALIRO_SESSION_KEY_LEN])

modules/woz_aliro/include/aliro_stepup.h:54

Fint aliro_stepup_build_device_request(const char *const *elems, size_t n_elems, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/include/aliro_stepup.h:63

Fint aliro_stepup_seal_sessiondata(struct aliro_secchan *sc, const uint8_t *plain, size_t plain_len, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/include/aliro_stepup.h:68

Fint aliro_stepup_open_sessiondata(struct aliro_secchan *sc, const uint8_t *sd, size_t sd_len, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/include/aliro_stepup.h:74

##define ALIRO_INS_ENVELOPE 0xC3u

modules/woz_aliro/include/aliro_stepup.h:80

##define ALIRO_INS_GET_RESPONSE 0xC0u

modules/woz_aliro/include/aliro_stepup.h:81

Fint aliro_stepup_build_envelope(const uint8_t *data, size_t data_len, int chaining, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/include/aliro_stepup.h:82

Fint aliro_stepup_build_get_response(uint8_t le, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/include/aliro_stepup.h:85

##define ALIRO_STEPUP_MAX_DIGESTS 24u

modules/woz_aliro/include/aliro_stepup.h:88

##define ALIRO_STEPUP_MAX_ITEMS 16u

modules/woz_aliro/include/aliro_stepup.h:89

##define ALIRO_STEPUP_ID_MAX 32u

modules/woz_aliro/include/aliro_stepup.h:90

Fint aliro_stepup_parse_response(const uint8_t *buf, size_t len, struct aliro_stepup_doc *doc)

modules/woz_aliro/include/aliro_stepup.h:160

Fint aliro_stepup_verify(const struct aliro_stepup_doc *doc, const struct aliro_stepup_verify_ctx *ctx, struct aliro_stepup_verdict *verdict)

modules/woz_aliro/include/aliro_stepup.h:211

Fint aliro_stepup_run(struct aliro_secchan *sc, const uint8_t *sd_resp, size_t sd_len, const struct aliro_stepup_verify_ctx *ctx, uint8_t *scratch, size_t scratch_cap, struct aliro_stepup_doc *doc, struct aliro_stepup_verdict *verdict)

modules/woz_aliro/include/aliro_stepup.h:219

Fint aliro_stepup_worker_submit(const struct aliro_stepup_job *job)

modules/woz_aliro/include/aliro_stepup.h:241

Fint aliro_stepup_worker_last(struct aliro_stepup_verdict *verdict, uint16_t *conn)

modules/woz_aliro/include/aliro_stepup.h:246