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

Functions

void u2f_emu_vdev_apdu_set_apdu (void *state, u2f_emu_apdu apdu)
 Set the APDU formatof the APDU transport. More...
 
bool u2f_emu_vdev_apdu_has_response (void *state)
 Check the precense of a response from the APDU transport. More...
 
size_t u2f_emu_vdev_apdu_get_response (void *state, uint8_t **data)
 Get the response frim the APDU transport. More...
 
void u2f_emu_vdev_apdu_process (void *state, const void *packet, size_t size)
 Process incoming data from an APDU. More...
 
void u2f_emu_vdev_apdu_state_free (void *state)
 Free the APDU state. More...
 
int u2f_emu_vdev_apdu_state_init (u2f_emu_vdev *vdev, void **state_ref)
 Init the APDU state. More...
 

Variables

transport_info_t apdu_transport
 The APDU transport. More...
 

Function Documentation

size_t u2f_emu_vdev_apdu_get_response ( void *  state,
uint8_t **  data 
)

Get the response frim the APDU transport.

Parameters
stateThe APDU transport state.
dataThe data ref buffer to put rhe resonse
Returns
The size of the allocated data.
bool u2f_emu_vdev_apdu_has_response ( void *  state)

Check the precense of a response from the APDU transport.

Parameters
stateThe APDU transport state.
Returns
Has response: true. Has no response: false.
void u2f_emu_vdev_apdu_process ( void *  state,
const void *  apdu,
size_t  size 
)

Process incoming data from an APDU.

Parameters
stateThe APDU transport state.
apduThe APDU.
sizeThe size of the APDU packet.
void u2f_emu_vdev_apdu_set_apdu ( void *  state,
u2f_emu_apdu  apdu 
)

Set the APDU formatof the APDU transport.

Parameters
stateThe APDU transport state.
apduThe APDU format to set.
void u2f_emu_vdev_apdu_state_free ( void *  state)

Free the APDU state.

Parameters
stateThe APDU transport state.
int u2f_emu_vdev_apdu_state_init ( u2f_emu_vdev vdev,
void **  state_ref 
)

Init the APDU state.

Parameters
vdevThe virtual device.
state_refThe APDU transport state ref.
Returns
Sucess: 0. Failure: -errno.

Variable Documentation

transport_info_t apdu_transport
Initial value:
=
{
.type = U2F_EMU_USB,
.input_handler = u2f_emu_vdev_apdu_process,
}
void u2f_emu_vdev_apdu_state_free(void *state)
Free the APDU state.
Definition: apdu.c:62
bool u2f_emu_vdev_apdu_has_response(void *state)
Check the precense of a response from the APDU transport.
Definition: apdu.c:16
Definition: u2f-emu-types.h:25
void u2f_emu_vdev_apdu_process(void *state, const void *packet, size_t size)
Process incoming data from an APDU.
Definition: apdu.c:44
void u2f_emu_vdev_apdu_set_apdu(void *state, u2f_emu_apdu apdu)
Set the APDU formatof the APDU transport.
Definition: apdu.c:8
size_t u2f_emu_vdev_apdu_get_response(void *state, uint8_t **data)
Get the response frim the APDU transport.
Definition: apdu.c:24
int u2f_emu_vdev_apdu_state_init(u2f_emu_vdev *vdev, void **state_ref)
Init the APDU state.
Definition: apdu.c:79

The APDU transport.