Libu2f-emu  0.0.0
Universal 2nd Factor (U2F) Emulation C Library
Data Structures | Macros | Functions | Variables
raw.h File Reference
#include <stddef.h>
#include <stdint.h>
#include "payload.h"
#include "u2f-emu-types.h"
Include dependency graph for raw.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  frame_header
 APDU Frame header. More...
 

Macros

#define __packed   __attribute__((__packed__))
 
#define U2F_REGISTER   0x01
 
#define U2F_AUTHENTICATE   0x02
 
#define U2F_VERSION   0x03
 
#define SW_NO_ERROR   0x9000
 
#define SW_CONDITIONS_NOT_SATISFIED   0x6985
 
#define SW_WRONG_DATA   0x6A80
 
#define SW_WRONG_LENGTH   0x6700
 
#define SW_CLA_NOT_SUPPORTED   0x6E00
 
#define SW_INS_NOT_SUPPORTED   0x6D00
 
#define U2F_AUTH_CHECK   0x07
 
#define U2F_AUTH_ENFORCE   0x03
 
#define U2F_AUTH_NO_ENFORCE   0x08
 
#define VERSION_STR   "U2F_V2"
 

Functions

struct frame_header __attribute__ ((__packed__))
 
struct payloadu2f_emu_vdev_raw_generate_error (uint16_t error)
 Generate an error raw payload response. 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...
 
struct payloadraw_authenticate (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size)
 Handle authentification request. More...
 
struct payloadraw_register (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size)
 Handle registration request. More...
 

Variables

uint8_t cla
 
uint8_t ins
 
uint8_t p1
 
uint8_t p2
 
uint8_t optional [4]
 

Macro Definition Documentation

#define __packed   __attribute__((__packed__))
#define SW_CLA_NOT_SUPPORTED   0x6E00
#define SW_CONDITIONS_NOT_SATISFIED   0x6985
#define SW_INS_NOT_SUPPORTED   0x6D00
#define SW_NO_ERROR   0x9000
#define SW_WRONG_DATA   0x6A80
#define SW_WRONG_LENGTH   0x6700
#define U2F_AUTH_CHECK   0x07
#define U2F_AUTH_ENFORCE   0x03
#define U2F_AUTH_NO_ENFORCE   0x08
#define U2F_AUTHENTICATE   0x02
#define U2F_REGISTER   0x01
#define U2F_VERSION   0x03
#define VERSION_STR   "U2F_V2"

Function Documentation

struct frame_header __attribute__ ( (__packed__)  )
struct payload* raw_authenticate ( u2f_emu_vdev vdev,
const uint8_t *  apdu,
size_t  size 
)

Handle authentification request.

Parameters
vdevThe virtual device.
apduThe apdu data.
sizeThe apdu data size.
Returns
The response payload.
struct payload* raw_register ( u2f_emu_vdev vdev,
const uint8_t *  apdu,
size_t  size 
)

Handle registration request.

Parameters
vdevThe virtual device.
apduThe apdu data.
sizeThe apdu data size.
Returns
The response payload.
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

uint8_t cla
uint8_t ins
uint8_t optional[4]
uint8_t p1
uint8_t p2