|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include "mod_gpg/openpgp/ccid.h"#include "mod_gpg/openpgp/openpgp.h"#include "mod_gpg/openpgp/apdu.h"#include "cdc_log.h"#include <string.h>#include <stdio.h>Go to the source code of this file.
Functions | |
| void | ccid_driver_link_anchor (void) |
| Initializes CCID transport and backing OpenPGP applet. | |
| bool | ccid_init (void) |
| const uint8_t * | ccid_get_atr (size_t *len) |
| Returns pointer and length of ATR bytes. | |
| bool | ccid_card_present (void) |
| Returns whether virtual CCID card is available. | |
| static void | ccid_build_header (uint8_t *resp, uint8_t msg_type, uint32_t data_len, uint8_t slot, uint8_t seq, uint8_t status, uint8_t error) |
| Builds a CCID response header in transport byte format. | |
| int | ccid_process_message (const uint8_t *msg, size_t msg_len, uint8_t *resp, size_t resp_max) |
| Processes one incoming CCID message and writes corresponding response. | |
Variables | |
| static const char * | TAG = "CCID" |
| USB CCID (Chip Card Interface Device) transport for OpenPGP applet. | |
| const uint8_t | CCID_DESCRIPTOR [] |
| CCID functional descriptor (54 bytes) per OpenPGP 3.4.1 profile. | |
| const size_t | CCID_DESCRIPTOR_LEN = sizeof(CCID_DESCRIPTOR) |
| static const uint8_t | ATR [] |
| ATR (Answer To Reset) for CDC Badge OpenPGP card. | |
| static bool | initialized = false |
| static uint8_t | current_slot = 0 |
| static uint8_t | current_seq = 0 |
|
static |
Builds a CCID response header in transport byte format.
| resp | Output response buffer. |
| msg_type | CCID response message type. |
| data_len | Payload length in bytes. |
| slot | Slot index. |
| seq | Sequence number. |
| status | CCID status flags. |
| error | CCID error code. |
Definition at line 126 of file ccid.cpp.
Referenced by ccid_process_message().
| bool ccid_card_present | ( | void | ) |
Returns whether virtual CCID card is available.
Definition at line 112 of file ccid.cpp.
References initialized.
| void ccid_driver_link_anchor | ( | void | ) |
Initializes CCID transport and backing OpenPGP applet.
Definition at line 226 of file ccid_driver.cpp.
Referenced by ccid_init().
| const uint8_t * ccid_get_atr | ( | size_t * | len | ) |
Returns pointer and length of ATR bytes.
| len | Optional output receiving ATR length. |
Definition at line 101 of file ccid.cpp.
References ATR.
Referenced by ccid_process_message().
| bool ccid_init | ( | void | ) |
Definition at line 83 of file ccid.cpp.
References ccid_driver_link_anchor(), initialized, LOG_E, LOG_I, openpgp_init(), and TAG.
Referenced by cdc::mod_gpg::GpgModule::start().
| int ccid_process_message | ( | const uint8_t * | msg, |
| size_t | msg_len, | ||
| uint8_t * | resp, | ||
| size_t | resp_max ) |
Processes one incoming CCID message and writes corresponding response.
| Message transfer (badge-to-badge) | Incoming CCID message bytes. |
| msg_len | Incoming message length. |
| resp | Output response buffer. |
| resp_max | Output buffer capacity. |
Definition at line 148 of file ccid.cpp.
References ccid_build_header(), CCID_CMD_STATUS_FAILED, CCID_ERROR_CMD_NOT_SUPPORTED, CCID_ERROR_HW_ERROR, CCID_ERROR_XFR_OVERRUN, ccid_get_atr(), CCID_HEADER_SIZE, ccid_header_t, CCID_ICC_PRESENT_ACTIVE, CCID_ICC_PRESENT_INACTIVE, CCID_PC_TO_RDR_GET_PARAMETERS, CCID_PC_TO_RDR_GET_SLOT_STATUS, CCID_PC_TO_RDR_ICC_POWER_OFF, CCID_PC_TO_RDR_ICC_POWER_ON, CCID_PC_TO_RDR_RESET_PARAMETERS, CCID_PC_TO_RDR_XFR_BLOCK, CCID_RDR_TO_PC_DATA_BLOCK, CCID_RDR_TO_PC_PARAMETERS, CCID_RDR_TO_PC_SLOT_STATUS, current_seq, current_slot, LOG_E, LOG_I, LOG_W, openpgp_process_apdu(), and TAG.
Referenced by ccid_driver_xfer_cb().
|
static |
ATR (Answer To Reset) for CDC Badge OpenPGP card.
T=1 protocol layout, OpenPGP 3.x compatible.
Definition at line 57 of file ccid.cpp.
Referenced by ccid_get_atr().
| const uint8_t CCID_DESCRIPTOR[] |
CCID functional descriptor (54 bytes) per OpenPGP 3.4.1 profile.
| const size_t CCID_DESCRIPTOR_LEN = sizeof(CCID_DESCRIPTOR) |
|
static |
Definition at line 75 of file ccid.cpp.
Referenced by ccid_process_message().
|
static |
Definition at line 74 of file ccid.cpp.
Referenced by ccid_process_message().
|
static |
USB CCID (Chip Card Interface Device) transport for OpenPGP applet.
Based on pico-openpgp (https://github.com/polhenarejos/pico-openpgp). Original project copyright: Pol Henarejos, AGPLv3.