Libu2f-emu
0.0.0
Universal 2nd Factor (U2F) Emulation C Library
|
Go to the source code of this file.
Data Structures | |
struct | cmd_init_resp_payload |
The command init reponse payload. More... | |
Macros | |
#define | BIT(x) (1 << (x)) |
#define | __packed __attribute__((__packed__)) |
#define | CMD_PING BIT(7) | 0x1 |
#define | CMD_MSG BIT(7) | 0x3 |
#define | CMD_LOCK BIT(7) | 0x4 |
#define | CMD_INIT BIT(7) | 0x6 |
#define | CMD_WINK BIT(7) | 0x8 |
#define | CMD_SYNC BIT(7) | 0x3c |
#define | CMD_ERROR BIT(7) | 0x3f |
#define | ERR_NONE 0x00 |
#define | ERR_INVALID_CMD 0x01 |
#define | ERR_INVALID_PAR 0x02 |
#define | ERR_INVALID_LEN 0x03 |
#define | ERR_INVALID_SEQ 0x04 |
#define | ERR_MSG_TIMEOUT 0x05 |
#define | ERR_CHANNEL_BUSY 0x06 |
#define | ERR_LOCK_REQUIRED 0x0a |
#define | ERR_SYNC_FAILED 0x0b |
#define | ERR_INVALID_CID 0x0b |
#define | ERR_OTHER 0x7f |
#define | PROTOCOL_VERSION 2 |
#define | MAJ_DEV_VERSION 0 |
#define | MIN_DEV_VERSION 1 |
#define | BUILD_DEV_VERSION 0 |
#define | CAP_FLAGS 0 |
#define | CAPABILITY_WINK 0 |
Functions | |
struct cmd_init_resp_payload | __attribute__ ((__packed__)) |
const char * | cmd_strerror (int error_nb) |
Get the command error description. More... | |
struct message * | cmd_generate_error (uint32_t cid, uint8_t error) |
Generate an error response. More... | |
struct message * | cmd_process (struct usb_state *state, const struct message *request) |
Process a command request. More... | |
Variables | |
uint8_t | nonce [8] |
uint32_t | cid |
uint8_t | protocol_ver |
uint8_t | maj_dev_ver |
uint8_t | min_dev_ver |
uint8_t | build_dev_ver |
uint8_t | cap_flags |
#define __packed __attribute__((__packed__)) |
#define BIT | ( | x | ) | (1 << (x)) |
#define BUILD_DEV_VERSION 0 |
#define CAP_FLAGS 0 |
#define CAPABILITY_WINK 0 |
#define CMD_ERROR BIT(7) | 0x3f |
#define CMD_INIT BIT(7) | 0x6 |
#define CMD_LOCK BIT(7) | 0x4 |
#define CMD_MSG BIT(7) | 0x3 |
#define CMD_PING BIT(7) | 0x1 |
#define CMD_SYNC BIT(7) | 0x3c |
#define CMD_WINK BIT(7) | 0x8 |
#define ERR_CHANNEL_BUSY 0x06 |
Channel is busy
#define ERR_INVALID_CID 0x0b |
Message on CID 0
#define ERR_INVALID_CMD 0x01 |
Invalid command
#define ERR_INVALID_LEN 0x03 |
Invalid message length
#define ERR_INVALID_PAR 0x02 |
Invalid parameter
#define ERR_INVALID_SEQ 0x04 |
Invalide message sequencing
#define ERR_LOCK_REQUIRED 0x0a |
Command requires channel lock
#define ERR_MSG_TIMEOUT 0x05 |
Message has timed out
#define ERR_NONE 0x00 |
No error
#define ERR_OTHER 0x7f |
Other unspecified error
#define ERR_SYNC_FAILED 0x0b |
Command sync failed
#define MAJ_DEV_VERSION 0 |
#define MIN_DEV_VERSION 1 |
#define PROTOCOL_VERSION 2 |
struct cmd_init_resp_payload __attribute__ | ( | (__packed__) | ) |
struct message* cmd_generate_error | ( | uint32_t | cid, |
uint8_t | error | ||
) |
Generate an error response.
cid | Channel id. |
error | The error. |
Process a command request.
state | The USB transport state. |
request | The command request message. |
< Invalid command
const char* cmd_strerror | ( | int | error_nb | ) |
Get the command error description.
error_nb | The error number. |
< No error
< Invalid command
< Invalid parameter
< Invalid message length
< Invalide message sequencing
< Message has timed out
< Channel is busy
< Command requires channel lock
< Command sync failed
< Other unspecified error
uint8_t build_dev_ver |
Build device version
uint8_t cap_flags |
Capabilities flags
uint32_t cid |
Channel id
Channel identifier
uint8_t maj_dev_ver |
Major device version
uint8_t min_dev_ver |
Minor device version
uint8_t nonce[8] |
Nonce
uint8_t protocol_ver |
U2FHID protocol version