Embedded SDK
Embedded SDK
Macros | Functions
u2f_transport.h File Reference
#include "u2f_service.h"
Include dependency graph for u2f_transport.h:

Go to the source code of this file.

Macros

#define U2F_CMD_PING   0x81
 
#define U2F_CMD_MSG   0x83
 
#define CTAP2_CMD_CBOR   0x90
 
#define CTAP2_CMD_CANCEL   0x91
 
#define U2F_CMD_INIT   0x86
 
#define U2F_CMD_LOCK   0x84
 
#define U2F_CMD_WINK   0x88
 
#define U2F_CMD_KEEPALIVE   0x82
 
#define KEEPALIVE_REASON_PROCESSING   0x01
 
#define KEEPALIVE_REASON_TUP_NEEDED   0x02
 
#define U2F_STATUS_ERROR   0xBF
 
#define CTAP2_STATUS_KEEPALIVE   0xBB
 
#define ERROR_NONE   0x00
 
#define ERROR_INVALID_CMD   0x01
 
#define ERROR_INVALID_PAR   0x02
 
#define ERROR_INVALID_LEN   0x03
 
#define ERROR_INVALID_SEQ   0x04
 
#define ERROR_MSG_TIMEOUT   0x05
 
#define ERROR_OTHER   0x7f
 
#define ERROR_CHANNEL_BUSY   0x06
 
#define ERROR_LOCK_REQUIRED   0x0a
 
#define ERROR_INVALID_CID   0x0b
 
#define ERROR_CBOR_UNEXPECTED_TYPE   0x11
 
#define ERROR_INVALID_CBOR   0x12
 
#define ERROR_MISSING_PARAMETER   0x14
 
#define ERROR_LIMIT_EXCEEDED   0x15
 
#define ERROR_UNSUPPORTED_EXTENSION   0x16
 
#define ERROR_CREDENTIAL_EXCLUDED   0x19
 
#define ERROR_PROCESSING   0x21
 
#define ERROR_INVALID_CREDENTIAL   0x22
 
#define ERROR_USER_ACTION_PENDING   0x23
 
#define ERROR_OPERATION_PENDING   0x24
 
#define ERROR_NO_OPERATIONS   0x25
 
#define ERROR_UNSUPPORTED_ALGORITHM   0x26
 
#define ERROR_OPERATION_DENIED   0x27
 
#define ERROR_KEY_STORE_FULL   0x28
 
#define ERROR_NO_OPERATION_PENDING   0x2A
 
#define ERROR_UNSUPPORTED_OPTION   0x2B
 
#define ERROR_INVALID_OPTION   0x2C
 
#define ERROR_KEEPALIVE_CANCEL   0x2D
 
#define ERROR_NO_CREDENTIALS   0x2E
 
#define ERROR_USER_ACTION_TIMEOUT   0x2F
 
#define ERROR_NOT_ALLOWED   0x30
 
#define ERROR_PIN_INVALID   0x31
 
#define ERROR_PIN_BLOCKED   0x32
 
#define ERROR_PIN_AUTH_INVALID   0x33
 
#define ERROR_PIN_AUTH_BLOCKED   0x34
 
#define ERROR_PIN_NOT_SET   0x35
 
#define ERROR_PIN_REQUIRED   0x36
 
#define ERROR_PIN_POLICY_VIOLATION   0x37
 
#define ERROR_PIN_TOKEN_EXPIRED   0x38
 
#define ERROR_REQUEST_TOO_LARGE   0x39
 
#define ERROR_ACTION_TIMEOUT   0x3A
 
#define ERROR_UP_REQUIRED   0x3B
 
#define ERROR_PROP_UNKNOWN_COMMAND   0x80
 
#define ERROR_PROP_COMMAND_TOO_LONG   0x81
 
#define ERROR_PROP_INVALID_CONTINUATION   0x82
 
#define ERROR_PROP_UNEXPECTED_CONTINUATION   0x83
 
#define ERROR_PROP_CONTINUATION_OVERFLOW   0x84
 
#define ERROR_PROP_MESSAGE_TOO_SHORT   0x85
 
#define ERROR_PROP_UNCONSISTENT_MSG_LENGTH   0x86
 
#define ERROR_PROP_UNSUPPORTED_MSG_APDU   0x87
 
#define ERROR_PROP_INVALID_DATA_LENGTH_APDU   0x88
 
#define ERROR_PROP_INTERNAL_ERROR_APDU   0x89
 
#define ERROR_PROP_INVALID_PARAMETERS_APDU   0x8A
 
#define ERROR_PROP_INVALID_DATA_APDU   0x8B
 
#define ERROR_PROP_DEVICE_NOT_SETUP   0x8C
 
#define ERROR_PROP_MEDIA_MIXED   0x8D
 
#define ERROR_PROP_RPID_MEDIA_DENIED   0x8E
 

Functions

void u2f_transport_init (u2f_service_t *service, uint8_t *message_buffer, uint16_t message_buffer_length)
 
void u2f_transport_sent (u2f_service_t *service, u2f_transport_media_t media)
 
void u2f_transport_received (u2f_service_t *service, uint8_t *buffer, uint16_t size, u2f_transport_media_t media)
 
bool u2f_is_channel_broadcast (uint8_t *channel)
 
bool u2f_is_channel_forbidden (uint8_t *channel)
 
void u2f_transport_ctap2_send_keepalive (u2f_service_t *service, uint8_t reason)
 

Macro Definition Documentation

◆ CTAP2_CMD_CANCEL

#define CTAP2_CMD_CANCEL   0x91

Definition at line 29 of file u2f_transport.h.

◆ CTAP2_CMD_CBOR

#define CTAP2_CMD_CBOR   0x90

Definition at line 28 of file u2f_transport.h.

◆ CTAP2_STATUS_KEEPALIVE

#define CTAP2_STATUS_KEEPALIVE   0xBB

Definition at line 42 of file u2f_transport.h.

◆ ERROR_ACTION_TIMEOUT

#define ERROR_ACTION_TIMEOUT   0x3A

Definition at line 87 of file u2f_transport.h.

◆ ERROR_CBOR_UNEXPECTED_TYPE

#define ERROR_CBOR_UNEXPECTED_TYPE   0x11

Definition at line 57 of file u2f_transport.h.

◆ ERROR_CHANNEL_BUSY

#define ERROR_CHANNEL_BUSY   0x06

Definition at line 53 of file u2f_transport.h.

◆ ERROR_CREDENTIAL_EXCLUDED

#define ERROR_CREDENTIAL_EXCLUDED   0x19

Definition at line 62 of file u2f_transport.h.

◆ ERROR_INVALID_CBOR

#define ERROR_INVALID_CBOR   0x12

Definition at line 58 of file u2f_transport.h.

◆ ERROR_INVALID_CID

#define ERROR_INVALID_CID   0x0b

Definition at line 55 of file u2f_transport.h.

◆ ERROR_INVALID_CMD

#define ERROR_INVALID_CMD   0x01

Definition at line 46 of file u2f_transport.h.

◆ ERROR_INVALID_CREDENTIAL

#define ERROR_INVALID_CREDENTIAL   0x22

Definition at line 64 of file u2f_transport.h.

◆ ERROR_INVALID_LEN

#define ERROR_INVALID_LEN   0x03

Definition at line 48 of file u2f_transport.h.

◆ ERROR_INVALID_OPTION

#define ERROR_INVALID_OPTION   0x2C

Definition at line 73 of file u2f_transport.h.

◆ ERROR_INVALID_PAR

#define ERROR_INVALID_PAR   0x02

Definition at line 47 of file u2f_transport.h.

◆ ERROR_INVALID_SEQ

#define ERROR_INVALID_SEQ   0x04

Definition at line 49 of file u2f_transport.h.

◆ ERROR_KEEPALIVE_CANCEL

#define ERROR_KEEPALIVE_CANCEL   0x2D

Definition at line 74 of file u2f_transport.h.

◆ ERROR_KEY_STORE_FULL

#define ERROR_KEY_STORE_FULL   0x28

Definition at line 70 of file u2f_transport.h.

◆ ERROR_LIMIT_EXCEEDED

#define ERROR_LIMIT_EXCEEDED   0x15

Definition at line 60 of file u2f_transport.h.

◆ ERROR_LOCK_REQUIRED

#define ERROR_LOCK_REQUIRED   0x0a

Definition at line 54 of file u2f_transport.h.

◆ ERROR_MISSING_PARAMETER

#define ERROR_MISSING_PARAMETER   0x14

Definition at line 59 of file u2f_transport.h.

◆ ERROR_MSG_TIMEOUT

#define ERROR_MSG_TIMEOUT   0x05

Definition at line 50 of file u2f_transport.h.

◆ ERROR_NO_CREDENTIALS

#define ERROR_NO_CREDENTIALS   0x2E

Definition at line 75 of file u2f_transport.h.

◆ ERROR_NO_OPERATION_PENDING

#define ERROR_NO_OPERATION_PENDING   0x2A

Definition at line 71 of file u2f_transport.h.

◆ ERROR_NO_OPERATIONS

#define ERROR_NO_OPERATIONS   0x25

Definition at line 67 of file u2f_transport.h.

◆ ERROR_NONE

#define ERROR_NONE   0x00

Definition at line 45 of file u2f_transport.h.

◆ ERROR_NOT_ALLOWED

#define ERROR_NOT_ALLOWED   0x30

Definition at line 77 of file u2f_transport.h.

◆ ERROR_OPERATION_DENIED

#define ERROR_OPERATION_DENIED   0x27

Definition at line 69 of file u2f_transport.h.

◆ ERROR_OPERATION_PENDING

#define ERROR_OPERATION_PENDING   0x24

Definition at line 66 of file u2f_transport.h.

◆ ERROR_OTHER

#define ERROR_OTHER   0x7f

Definition at line 51 of file u2f_transport.h.

◆ ERROR_PIN_AUTH_BLOCKED

#define ERROR_PIN_AUTH_BLOCKED   0x34

Definition at line 81 of file u2f_transport.h.

◆ ERROR_PIN_AUTH_INVALID

#define ERROR_PIN_AUTH_INVALID   0x33

Definition at line 80 of file u2f_transport.h.

◆ ERROR_PIN_BLOCKED

#define ERROR_PIN_BLOCKED   0x32

Definition at line 79 of file u2f_transport.h.

◆ ERROR_PIN_INVALID

#define ERROR_PIN_INVALID   0x31

Definition at line 78 of file u2f_transport.h.

◆ ERROR_PIN_NOT_SET

#define ERROR_PIN_NOT_SET   0x35

Definition at line 82 of file u2f_transport.h.

◆ ERROR_PIN_POLICY_VIOLATION

#define ERROR_PIN_POLICY_VIOLATION   0x37

Definition at line 84 of file u2f_transport.h.

◆ ERROR_PIN_REQUIRED

#define ERROR_PIN_REQUIRED   0x36

Definition at line 83 of file u2f_transport.h.

◆ ERROR_PIN_TOKEN_EXPIRED

#define ERROR_PIN_TOKEN_EXPIRED   0x38

Definition at line 85 of file u2f_transport.h.

◆ ERROR_PROCESSING

#define ERROR_PROCESSING   0x21

Definition at line 63 of file u2f_transport.h.

◆ ERROR_PROP_COMMAND_TOO_LONG

#define ERROR_PROP_COMMAND_TOO_LONG   0x81

Definition at line 91 of file u2f_transport.h.

◆ ERROR_PROP_CONTINUATION_OVERFLOW

#define ERROR_PROP_CONTINUATION_OVERFLOW   0x84

Definition at line 94 of file u2f_transport.h.

◆ ERROR_PROP_DEVICE_NOT_SETUP

#define ERROR_PROP_DEVICE_NOT_SETUP   0x8C

Definition at line 102 of file u2f_transport.h.

◆ ERROR_PROP_INTERNAL_ERROR_APDU

#define ERROR_PROP_INTERNAL_ERROR_APDU   0x89

Definition at line 99 of file u2f_transport.h.

◆ ERROR_PROP_INVALID_CONTINUATION

#define ERROR_PROP_INVALID_CONTINUATION   0x82

Definition at line 92 of file u2f_transport.h.

◆ ERROR_PROP_INVALID_DATA_APDU

#define ERROR_PROP_INVALID_DATA_APDU   0x8B

Definition at line 101 of file u2f_transport.h.

◆ ERROR_PROP_INVALID_DATA_LENGTH_APDU

#define ERROR_PROP_INVALID_DATA_LENGTH_APDU   0x88

Definition at line 98 of file u2f_transport.h.

◆ ERROR_PROP_INVALID_PARAMETERS_APDU

#define ERROR_PROP_INVALID_PARAMETERS_APDU   0x8A

Definition at line 100 of file u2f_transport.h.

◆ ERROR_PROP_MEDIA_MIXED

#define ERROR_PROP_MEDIA_MIXED   0x8D

Definition at line 103 of file u2f_transport.h.

◆ ERROR_PROP_MESSAGE_TOO_SHORT

#define ERROR_PROP_MESSAGE_TOO_SHORT   0x85

Definition at line 95 of file u2f_transport.h.

◆ ERROR_PROP_RPID_MEDIA_DENIED

#define ERROR_PROP_RPID_MEDIA_DENIED   0x8E

Definition at line 104 of file u2f_transport.h.

◆ ERROR_PROP_UNCONSISTENT_MSG_LENGTH

#define ERROR_PROP_UNCONSISTENT_MSG_LENGTH   0x86

Definition at line 96 of file u2f_transport.h.

◆ ERROR_PROP_UNEXPECTED_CONTINUATION

#define ERROR_PROP_UNEXPECTED_CONTINUATION   0x83

Definition at line 93 of file u2f_transport.h.

◆ ERROR_PROP_UNKNOWN_COMMAND

#define ERROR_PROP_UNKNOWN_COMMAND   0x80

Definition at line 90 of file u2f_transport.h.

◆ ERROR_PROP_UNSUPPORTED_MSG_APDU

#define ERROR_PROP_UNSUPPORTED_MSG_APDU   0x87

Definition at line 97 of file u2f_transport.h.

◆ ERROR_REQUEST_TOO_LARGE

#define ERROR_REQUEST_TOO_LARGE   0x39

Definition at line 86 of file u2f_transport.h.

◆ ERROR_UNSUPPORTED_ALGORITHM

#define ERROR_UNSUPPORTED_ALGORITHM   0x26

Definition at line 68 of file u2f_transport.h.

◆ ERROR_UNSUPPORTED_EXTENSION

#define ERROR_UNSUPPORTED_EXTENSION   0x16

Definition at line 61 of file u2f_transport.h.

◆ ERROR_UNSUPPORTED_OPTION

#define ERROR_UNSUPPORTED_OPTION   0x2B

Definition at line 72 of file u2f_transport.h.

◆ ERROR_UP_REQUIRED

#define ERROR_UP_REQUIRED   0x3B

Definition at line 88 of file u2f_transport.h.

◆ ERROR_USER_ACTION_PENDING

#define ERROR_USER_ACTION_PENDING   0x23

Definition at line 65 of file u2f_transport.h.

◆ ERROR_USER_ACTION_TIMEOUT

#define ERROR_USER_ACTION_TIMEOUT   0x2F

Definition at line 76 of file u2f_transport.h.

◆ KEEPALIVE_REASON_PROCESSING

#define KEEPALIVE_REASON_PROCESSING   0x01

Definition at line 38 of file u2f_transport.h.

◆ KEEPALIVE_REASON_TUP_NEEDED

#define KEEPALIVE_REASON_TUP_NEEDED   0x02

Definition at line 39 of file u2f_transport.h.

◆ U2F_CMD_INIT

#define U2F_CMD_INIT   0x86

Definition at line 32 of file u2f_transport.h.

◆ U2F_CMD_KEEPALIVE

#define U2F_CMD_KEEPALIVE   0x82

Definition at line 37 of file u2f_transport.h.

◆ U2F_CMD_LOCK

#define U2F_CMD_LOCK   0x84

Definition at line 33 of file u2f_transport.h.

◆ U2F_CMD_MSG

#define U2F_CMD_MSG   0x83

Definition at line 27 of file u2f_transport.h.

◆ U2F_CMD_PING

#define U2F_CMD_PING   0x81

Definition at line 26 of file u2f_transport.h.

◆ U2F_CMD_WINK

#define U2F_CMD_WINK   0x88

Definition at line 34 of file u2f_transport.h.

◆ U2F_STATUS_ERROR

#define U2F_STATUS_ERROR   0xBF

Definition at line 41 of file u2f_transport.h.

Function Documentation

◆ u2f_is_channel_broadcast()

bool u2f_is_channel_broadcast ( uint8_t channel)

Returns 0 if the provided channel buffer is not a broadcast channel

◆ u2f_is_channel_forbidden()

bool u2f_is_channel_forbidden ( uint8_t channel)

Returns 0 if the provided channel buffer is not a forbidden channel

◆ u2f_transport_ctap2_send_keepalive()

void u2f_transport_ctap2_send_keepalive ( u2f_service_t service,
uint8_t  reason 
)

Send a CTAP 2 KEEPALIVE command while processing a CBOR message

◆ u2f_transport_init()

void u2f_transport_init ( u2f_service_t service,
uint8_t message_buffer,
uint16_t  message_buffer_length 
)

Initialize the U2F transport library Incoming messages are store in the provided message buffer. It can be overlapped with io APDU buffer to save RAM (but won't allow for multiple IO model (no mutual exclusion in the buffer access))

◆ u2f_transport_received()

void u2f_transport_received ( u2f_service_t service,
uint8_t buffer,
uint16_t  size,
u2f_transport_media_t  media 
)

Function to be called when an IO message has been received.

◆ u2f_transport_sent()

void u2f_transport_sent ( u2f_service_t service,
u2f_transport_media_t  media 
)

Function to be called when an IO message has been sent.