modules/woz_aliro/src/aliro_apdu.h
asxeem/openaliro
Module

aliro_apdu.h

APDU framing and parsing for the Aliro Access Protocol: builds outbound command APDUs via a…

modules/woz_aliro/src/aliro_apdu.h3 documented symbols

Overview

APDU framing and parsing for the Aliro Access Protocol: builds outbound command APDUs via a TLV writer and parses the AUTH0/AUTH1 response APDUs exchanged during the reader-device handshake.

used by aliro_apdu.c aliro_reader.c

API

Cstruct aliro_tlv_w

modules/woz_aliro/src/aliro_apdu.h:61

---- BER-TLV writer ----

Cstruct aliro_auth0_response

modules/woz_aliro/src/aliro_apdu.h:114

Fields parsed from an AUTH0Response APDU: the device's mandatory ephemeral public key, plus the optional cryptogram sent when the device recognises the reader and offers the fast path.

Cstruct aliro_auth1_response

modules/woz_aliro/src/aliro_apdu.h:124

Fields parsed from an AUTH1Response APDU: the device's mandatory signature over the transcript, plus the device public key and signaling bitmap it sends when the standard (non-fast) path is taken.

##define ALIRO_PROTO_ACCESS 0x00u

modules/woz_aliro/src/aliro_apdu.h:27

##define ALIRO_PROTO_NOTIFICATION 0x02u

modules/woz_aliro/src/aliro_apdu.h:28

##define ALIRO_AP_OP_COMMAND 0x00u

modules/woz_aliro/src/aliro_apdu.h:31

##define ALIRO_AP_OP_RESPONSE 0x01u

modules/woz_aliro/src/aliro_apdu.h:32

##define ALIRO_NOTIF_EVENT 0x00u

modules/woz_aliro/src/aliro_apdu.h:35

##define ALIRO_NOTIF_INITIATE_AP 0x05u

modules/woz_aliro/src/aliro_apdu.h:36

##define ALIRO_INS_AUTH0 0x80u

modules/woz_aliro/src/aliro_apdu.h:41

##define ALIRO_INS_AUTH1 0x81u

modules/woz_aliro/src/aliro_apdu.h:42

##define ALIRO_INS_EXCHANGE 0xC9u

modules/woz_aliro/src/aliro_apdu.h:43

##define ALIRO_TAG_EXP_PHASE 0x41u

modules/woz_aliro/src/aliro_apdu.h:46

##define ALIRO_TAG_USER_POL 0x42u

modules/woz_aliro/src/aliro_apdu.h:47

##define ALIRO_TAG_VERSION 0x5Cu

modules/woz_aliro/src/aliro_apdu.h:48

##define ALIRO_TAG_READER_EPH 0x87u

modules/woz_aliro/src/aliro_apdu.h:49

##define ALIRO_TAG_TXID 0x4Cu

modules/woz_aliro/src/aliro_apdu.h:50

##define ALIRO_TAG_READER_ID 0x4Du

modules/woz_aliro/src/aliro_apdu.h:51

##define ALIRO_TAG_SIG 0x9Eu

modules/woz_aliro/src/aliro_apdu.h:52

##define ALIRO_TAG_USAGE 0x93u

modules/woz_aliro/src/aliro_apdu.h:55

##define ALIRO_TAG_DEVICE_PUB 0x5Au

modules/woz_aliro/src/aliro_apdu.h:56

##define ALIRO_TAG_STATUS 0x97u

modules/woz_aliro/src/aliro_apdu.h:57

##define ALIRO_TAG_URSK_READY 0x98u

modules/woz_aliro/src/aliro_apdu.h:58

Fvoid aliro_tlv_w_init(struct aliro_tlv_w *w, uint8_t *buf, size_t cap)

modules/woz_aliro/src/aliro_apdu.h:68

Fvoid aliro_tlv_put(struct aliro_tlv_w *w, uint8_t tag, const uint8_t *val, size_t len)

modules/woz_aliro/src/aliro_apdu.h:69

Fvoid aliro_tlv_put_u8(struct aliro_tlv_w *w, uint8_t tag, uint8_t v)

modules/woz_aliro/src/aliro_apdu.h:70

Fvoid aliro_tlv_put_u16(struct aliro_tlv_w *w, uint8_t tag, uint16_t v)

modules/woz_aliro/src/aliro_apdu.h:71

Fvoid aliro_tlv_put_empty(struct aliro_tlv_w *w, uint8_t tag)

modules/woz_aliro/src/aliro_apdu.h:72

Fint aliro_tlv_w_finish(struct aliro_tlv_w *w, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:73

Fint aliro_tlv_find(const uint8_t *buf, size_t buf_len, uint8_t tag, const uint8_t **val, size_t *val_len)

modules/woz_aliro/src/aliro_apdu.h:76

Fint aliro_apdu_build_auth0(uint8_t exp_phase, uint8_t user_policy, uint16_t version, const uint8_t reader_eph_pub[65], const uint8_t txid[16], const uint8_t reader_id[32], uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:80

Fint aliro_apdu_build_auth1(uint8_t cred_type, const uint8_t sig[64], uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:83

##define ALIRO_AUTH_READER 1

modules/woz_aliro/src/aliro_apdu.h:89

##define ALIRO_AUTH_DEVICE 0

modules/woz_aliro/src/aliro_apdu.h:90

Fint aliro_apdu_build_authdata(int which, const uint8_t reader_id[32], const uint8_t device_pubx[32], const uint8_t reader_eph_pubx[32], const uint8_t txid[16], uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:91

Fint aliro_apdu_build_exchange(int have_status, uint16_t reader_status, int ursk_ready, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:96

Fint aliro_apdu_wrap(uint8_t ins, const uint8_t *tlv, size_t tlv_len, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:102

Fint aliro_apdu_strip_sw(const uint8_t *buf, size_t *len, uint16_t *sw)

modules/woz_aliro/src/aliro_apdu.h:109

Fint aliro_apdu_parse_auth0_response(const uint8_t *buf, size_t len, struct aliro_auth0_response *r)

modules/woz_aliro/src/aliro_apdu.h:119

Fint aliro_apdu_parse_auth1_response(const uint8_t *buf, size_t len, struct aliro_auth1_response *r)

modules/woz_aliro/src/aliro_apdu.h:130

##define ALIRO_ENVELOPE_HDR 4u

modules/woz_aliro/src/aliro_apdu.h:133

Fint aliro_ble_frame(uint8_t type, uint8_t opcode, const uint8_t *payload, size_t plen, uint8_t *out, size_t cap, size_t *out_len)

modules/woz_aliro/src/aliro_apdu.h:134

Fint aliro_ble_unframe(const uint8_t *buf, size_t len, uint8_t *type, uint8_t *opcode, const uint8_t **payload, size_t *plen)

modules/woz_aliro/src/aliro_apdu.h:136