22#ifndef FIDO2_CTAP_TRANSPORT_HID_CTAP_HID_H
23#define FIDO2_CTAP_TRANSPORT_HID_CTAP_HID_H
38#define CTAP_HID_INIT_PAYLOAD_SIZE (CONFIG_USBUS_HID_INTERRUPT_EP_SIZE - 7)
39#define CTAP_HID_CONT_PAYLOAD_SIZE (CONFIG_USBUS_HID_INTERRUPT_EP_SIZE - 5)
45#define CTAP_HID_PROTOCOL_VERSION 0x02
52#define CTAP_HID_INIT_PACKET 0x80
53#define CTAP_HID_CONT_PACKET 0x00
59#define CTAP_HID_INIT_NONCE_SIZE 8
64#ifdef CONFIG_FIDO2_CTAP_TRANSPORT_HID_TRANSACTION_TIMEOUT
65#define CTAP_HID_TRANSACTION_TIMEOUT_MS (CONFIG_FIDO2_CTAP_TRANSPORT_HID_TRANSACTION_TIMEOUT)
67#define CTAP_HID_TRANSACTION_TIMEOUT_MS (500)
75#define CTAP_HID_BUFFER_SIZE 7609
82#define CTAP_HID_COMMAND_PING (0x01 | CTAP_HID_INIT_PACKET)
83#define CTAP_HID_COMMAND_MSG (0x03 | CTAP_HID_INIT_PACKET)
84#define CTAP_HID_COMMAND_LOCK (0x04 | CTAP_HID_INIT_PACKET)
85#define CTAP_HID_COMMAND_INIT (0x06 | CTAP_HID_INIT_PACKET)
86#define CTAP_HID_COMMAND_WINK (0x08 | CTAP_HID_INIT_PACKET)
87#define CTAP_HID_COMMAND_CBOR (0x10 | CTAP_HID_INIT_PACKET)
88#define CTAP_HID_COMMAND_CANCEL (0x11 | CTAP_HID_INIT_PACKET)
89#define CTAP_HID_COMMAND_KEEPALIVE (0x3b | CTAP_HID_INIT_PACKET)
90#define CTAP_HID_COMMAND_ERROR (0x3f | CTAP_HID_INIT_PACKET)
98#define CTAP_HID_CAPABILITY_WINK 0x01
99#define CTAP_HID_CAPABILITY_CBOR 0x04
100#define CTAP_HID_CAPABILITY_NMSG 0x08
108#define CTAP_HID_OK 0x00
109#define CTAP_HID_ERR_INVALID_CMD 0x01
110#define CTAP_HID_ERR_INVALID_PAR 0x02
111#define CTAP_HID_ERR_INVALID_LEN 0x03
112#define CTAP_HID_ERR_INVALID_SEQ 0x04
113#define CTAP_HID_ERR_MSG_TIMEOUT 0x05
114#define CTAP_HID_ERR_CHANNEL_BUSY 0x06
115#define CTAP_HID_ERR_LOCK_REQUIRED 0x0a
116#define CTAP_HID_ERR_INVALID_CHANNEL 0x0b
117#define CTAP_HID_ERR_OTHER 0x7f
125#define CTAP_HID_STATUS_PROCESSING 0x01
126#define CTAP_HID_STATUS_UPNEEDED 0x02
133#define CTAP_HID_CIDS_MAX 0x08
138#define CTAP_HID_WINK_DELAY 400
144#define CTAP_HID_BROADCAST_CID 0xffffffff
151#define CTAP_HID_BUFFER_STATUS_BUFFERING 0x00
152#define CTAP_HID_BUFFER_STATUS_DONE 0x01
153#define CTAP_HID_BUFFER_STATUS_ERROR 0x02
193typedef struct __attribute__((packed)){
#define CTAP_HID_CONT_PAYLOAD_SIZE
endpoint size - cont packet metadata
#define CTAP_HID_INIT_PAYLOAD_SIZE
endpoint size - init packet metadata
#define CTAP_HID_INIT_NONCE_SIZE
CTAP_HID size of nonce for init request.
void fido2_ctap_transport_hid_init(event_queue_t *queue)
Initialize CTAPHID.
bool fido2_ctap_transport_hid_should_cancel(void)
Check if CTAPHID layer has received CANCEL command.
void fido2_ctap_transport_hid_check_timeouts(void)
Check logical channels for timeouts.
void fido2_ctap_transport_hid_handle_packet(void *pkt_raw)
Handle CTAP_HID packet.
CTAP_HID channel identifier struct.
uint64_t last_used
timestamp of last usage
uint32_t cid
channel identifier
CTAP_HID continuation packet struct.
uint8_t seq
packet sequence number
CTAP_HID initialization packet struct.
uint8_t cmd
CTAP_HID command.
CTAP_HID initialization response struct.
uint8_t protocol_version
CTAP_HID protocol version.
uint8_t version_minor
minor device version
uint8_t version_major
major device version
uint32_t cid
channel identifier
uint8_t build_version
build device version
uint8_t capabilities
capabilities flags
ctap_hid_cont_pkt_t cont
continuation packet
ctap_hid_init_pkt_t init
initialization packet
uint32_t cid
channel identifier
Interface and definitions for USB HID type interfaces in USBUS.