|
Libu2f-emu
0.0.0
Universal 2nd Factor (U2F) Emulation C Library
|
#include <stdlib.h>#include <string.h>#include "counter.h"#include "crypto.h"#include "raw.h"#include "u2f-vdev.h"
Macros | |
| #define | U2F_AUTH_CHECK 0x07 |
| #define | U2F_AUTH_ENFORCE 0x03 |
| #define | U2F_AUTH_NO_ENFORCE 0x08 |
| #define | U2F_CHA_PARAM_SIZE 32 |
| #define | U2F_APP_PARAM_SIZE 32 |
Functions | |
| struct authentification_params | __attribute__ ((__packed__)) |
| static void | authenticate_response_user_pre (struct payload *payload, uint8_t presence) |
| Add user precense to the authentification response payload. More... | |
| static void | authenticate_response_counter (struct payload *payload, uint32_t counter) |
| Add counter to the authentification response payload. More... | |
| static void | authenticate_response_signature (struct payload *payload, EC_KEY *key, const struct authentification_params *params, uint8_t presence, uint32_t counter) |
| Add the signature to the authentification response payload. More... | |
| static void | authenticate_response_sw (struct payload *payload, uint32_t status) |
| Add status code to the authentification response payload. More... | |
| static uint8_t * | authenticate_get_key_handle_cipher (const uint8_t *apdu, size_t apdu_size, const struct authentification_params *params, uint8_t *size) |
| Get the ciphered key handle from the request. More... | |
| static uint8_t * | authenticate_decrypt_key_handle_cipher (struct crypto_core *crypto_core, const uint8_t *key_handle_cipher, size_t key_handle_cipher_size, size_t *size) |
| Decrypt ciphered key handle. More... | |
| static EC_KEY * | authenticate_get_pubkey_from_key_handle (const uint8_t *key_handle, size_t key_handle_size) |
| Get the pubkey from the key handle. More... | |
| static struct payload * | raw_authenticate_check (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size) |
| Handle check authentification request. More... | |
| static struct payload * | raw_authenticate_enforce (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size) |
| Handle enforce authentification request. More... | |
| static struct payload * | raw_authenticate_no_enforce (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size) |
| Handle no enforce authentification request. More... | |
| struct payload * | raw_authenticate (u2f_emu_vdev *vdev, const uint8_t *apdu, size_t size) |
| Handle authentification request. More... | |
Variables | |
| uint8_t | challenge_param [32] |
| uint8_t | application_param [32] |
| uint8_t | key_handle_size |
| uint8_t | key_handle [] |
| #define U2F_APP_PARAM_SIZE 32 |
| #define U2F_AUTH_CHECK 0x07 |
| #define U2F_AUTH_ENFORCE 0x03 |
| #define U2F_AUTH_NO_ENFORCE 0x08 |
| #define U2F_CHA_PARAM_SIZE 32 |
| struct authentification_params __attribute__ | ( | (__packed__) | ) |
|
static |
Decrypt ciphered key handle.
| crypto_core | The crypto core. |
| key_handle_cipher | The ciphered key handle. |
| key_handle_cipher_size | The ciphered key handle size. |
| size | The ref size of the plain key handle. |
|
static |
Get the ciphered key handle from the request.
| apdu | The apdu data. |
| apdu_size | The apdu data size. |
| params | The authentification response. |
| size | The ref size of the ciphered key handle. |
|
static |
Get the pubkey from the key handle.
| key_handle | The plain key handle |
| key_handle_size | The plain key handle size |
|
static |
Add counter to the authentification response payload.
| payload | The response payload. |
| counter | The counter. |
|
static |
Add the signature to the authentification response payload.
| payload | The response payload. |
| key | The key used to sign. |
| params | The authentification params. |
| presence | The user presence. |
| counter | The counter. |
|
static |
Add status code to the authentification response payload.
| payload | The response payload. |
| status | The status code. |
|
static |
Add user precense to the authentification response payload.
| payload | The response payload. |
| presence | The presence. |
| struct payload* raw_authenticate | ( | u2f_emu_vdev * | vdev, |
| const uint8_t * | apdu, | ||
| size_t | size | ||
| ) |
Handle authentification request.
| vdev | The virtual device. |
| apdu | The apdu data. |
| size | The apdu data size. |
|
static |
Handle check authentification request.
| vdev | The virtual device. |
| apdu | The apdu data. |
| size | The apdu data size. |
|
static |
Handle enforce authentification request.
| vdev | The virtual device. |
| apdu | The apdu data. |
| size | The apdu data size. |
|
static |
Handle no enforce authentification request.
| vdev | The virtual device. |
| apdu | The apdu data. |
| size | The apdu data size. |
| uint8_t application_param[32] |
SHA-256 App Id
| uint8_t challenge_param[32] |
SHA-256 client data
| uint8_t key_handle[] |
| uint8_t key_handle_size |
1.8.10