Libu2f-emu  0.0.0
Universal 2nd Factor (U2F) Emulation C Library
Typedefs | Functions | Variables
raw.c File Reference
#include <string.h>
#include "raw.h"
Include dependency graph for raw.c:

Typedefs

typedef struct payload *(* raw_cmd_handler_t) (u2f_emu_vdev *vdev, const uint8_t *packet, size_t size)
 Raw cmd handler for U2F APDU processing. More...
 
typedef struct raw_cmd raw_cmd_t
 Raw command of U2F APDU. More...
 

Functions

static struct payloadraw_version (u2f_emu_vdev *vdev, const uint8_t *packet, size_t size)
 
static raw_cmd_handler_t raw_cmd_get_handler (uint8_t cmd)
 Get the raw command handler for a specific raw command. More...
 
struct payloadu2f_emu_vdev_raw_generate_error (uint16_t error)
 Generate an error raw payload response. More...
 
static struct payloadraw_version (u2f_emu_vdev *vdev __attribute__((unused)), const uint8_t *apdu __attribute__((unused)), size_t size __attribute__((unused)))
 The Handler for U2F_VERSION raw cmd. More...
 
struct payloadu2f_emu_vdev_raw_process (u2f_emu_vdev *vdev, const void *apdu, size_t size)
 Process incoming data from a RAW APDU. More...
 

Variables

static const raw_cmd_t raw_cmds []
 Raw commands handlers for U2F APDU commands processing, depending of the associated command. More...
 
static const size_t raw_cmds_nb
 Number of commands. More...
 

Typedef Documentation

typedef struct payload*(* raw_cmd_handler_t) (u2f_emu_vdev *vdev, const uint8_t *packet, size_t size)

Raw cmd handler for U2F APDU processing.

typedef struct raw_cmd raw_cmd_t

Raw command of U2F APDU.

Function Documentation

static raw_cmd_handler_t raw_cmd_get_handler ( uint8_t  cmd)
static

Get the raw command handler for a specific raw command.

Parameters
cmdThe raw command.
Returns
The raw command handler.
static struct payload* raw_version ( u2f_emu_vdev vdev,
const uint8_t *  packet,
size_t  size 
)
static
static struct payload* raw_version ( u2f_emu_vdev *vdev   __attribute__(unused),
const uint8_t *apdu   __attribute__(unused),
size_t size   __attribute__(unused) 
)
static

The Handler for U2F_VERSION raw cmd.

Parameters
vdevThe virtual device.
apduThe apdu data.
sizeThe apdu data size.
Returns
The response.
struct payload* u2f_emu_vdev_raw_generate_error ( uint16_t  error)

Generate an error raw payload response.

Parameters
errorThe error.
Returns
The respective error raw payload reponse generated
struct payload* u2f_emu_vdev_raw_process ( u2f_emu_vdev vdev,
const void *  apdu,
size_t  size 
)

Process incoming data from a RAW APDU.

Parameters
vdevThe virtual device.
apduThe RAW APDU packet.
sizeThe size of the RAW APDU packet.
Returns
The response payload.

Variable Documentation

const raw_cmd_t raw_cmds[]
static
Initial value:
=
{
{ 0x01 , raw_register },
{ 0x02 , raw_authenticate },
{ 0x03 , raw_version },
}
struct payload * raw_authenticate(u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size)
Handle authentification request.
Definition: authenticate.c:382
static struct payload * raw_version(u2f_emu_vdev *vdev, const uint8_t *packet, size_t size)
struct payload * raw_register(u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size)
Handle registration request.
Definition: register.c:266

Raw commands handlers for U2F APDU commands processing, depending of the associated command.

const size_t raw_cmds_nb
static
Initial value:
=
sizeof(raw_cmds) / sizeof(raw_cmds[0])
static const raw_cmd_t raw_cmds[]
Raw commands handlers for U2F APDU commands processing, depending of the associated command...
Definition: raw.c:30

Number of commands.