|
CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
|
#include <stdint.h>#include <stdbool.h>#include <stddef.h>Go to the source code of this file.
Classes | |
| struct | cdc::mod_gpg::openpgp::apdu_t |
Namespaces | |
| namespace | cdc |
| namespace | cdc::mod_gpg |
| namespace | cdc::mod_gpg::openpgp |
Macros | |
| #define | CLA_ISO7816 0x00 |
| #define | CLA_CHAIN 0x10 |
| #define | INS_SELECT 0xA4 |
| #define | INS_GET_DATA 0xCA |
| #define | INS_PUT_DATA 0xDA |
| #define | INS_PUT_DATA_ODD 0xDB |
| #define | INS_VERIFY 0x20 |
| #define | INS_CHANGE_PIN 0x24 |
| #define | INS_RESET_RETRY 0x2C |
| #define | INS_PSO 0x2A |
| #define | INS_INTERNAL_AUTH 0x88 |
| #define | INS_GENERATE_KEYPAIR 0x47 |
| #define | INS_GET_CHALLENGE 0x84 |
| #define | INS_GET_RESPONSE 0xC0 |
| #define | INS_TERMINATE 0xE6 |
| #define | INS_ACTIVATE 0x44 |
| #define | INS_GET_VERSION 0xF1 |
| #define | INS_MSE 0x22 |
| #define | PSO_CDS 0x9E9A |
| #define | PSO_DEC 0x8086 |
| #define | PSO_ENC 0x8680 |
Functions | |
| bool | apdu_parse (const uint8_t *raw, size_t raw_len, apdu_t *apdu) |
| ISO 7816 APDU parsing/building helpers for CDC Badge OpenPGP stack. | |
| size_t | apdu_build_response (uint8_t *buf, size_t buf_max, const uint8_t *data, size_t data_len, uint16_t sw) |
| Builds APDU response payload with status word trailer. | |
| static size_t | apdu_sw (uint8_t *buf, uint16_t sw) |
| #define INS_ACTIVATE 0x44 |
Definition at line 35 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_CHANGE_PIN 0x24 |
Definition at line 27 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_GENERATE_KEYPAIR 0x47 |
Definition at line 31 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_GET_CHALLENGE 0x84 |
Definition at line 32 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_GET_DATA 0xCA |
Definition at line 23 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_GET_RESPONSE 0xC0 |
Definition at line 33 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_INTERNAL_AUTH 0x88 |
Definition at line 30 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_MSE 0x22 |
Definition at line 37 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_PSO 0x2A |
Definition at line 29 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_PUT_DATA 0xDA |
Definition at line 24 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_PUT_DATA_ODD 0xDB |
Definition at line 25 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_RESET_RETRY 0x2C |
Definition at line 28 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_SELECT 0xA4 |
Definition at line 22 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_TERMINATE 0xE6 |
Definition at line 34 of file apdu.h.
Referenced by openpgp_process_apdu().
| #define INS_VERIFY 0x20 |
Definition at line 26 of file apdu.h.
Referenced by openpgp_process_apdu().
| size_t apdu_build_response | ( | uint8_t * | buf, |
| size_t | buf_max, | ||
| const uint8_t * | data, | ||
| size_t | data_len, | ||
| uint16_t | sw ) |
Builds APDU response payload with status word trailer.
| buf | Output response buffer. |
| buf_max | Capacity of buf. |
| data | Optional payload bytes. |
| data_len | Payload length. |
| sw | ISO7816 status word. |
Definition at line 99 of file apdu.cpp.
Referenced by cmd_generate_keypair(), cmd_get_data(), cmd_internal_authenticate(), cmd_pso_cds(), cmd_pso_decipher(), cmd_pso_decipher_aes(), and openpgp_process_apdu().
| bool apdu_parse | ( | const uint8_t * | raw, |
| size_t | raw_len, | ||
| apdu_t * | apdu ) |
ISO 7816 APDU parsing/building helpers for CDC Badge OpenPGP stack.
Based on pico-openpgp (https://github.com/polhenarejos/pico-openpgp).
Parses raw APDU bytes into structured representation.
| raw | Raw APDU buffer. |
| raw_len | Length of raw. |
| apdu | Output APDU structure. |
Definition at line 17 of file apdu.cpp.
Referenced by openpgp_process_apdu().
|
inlinestatic |
Definition at line 75 of file apdu.h.
Referenced by apply_put_data_desc(), cmd_activate_file(), cmd_change_reference_data(), cmd_generate_keypair(), cmd_get_data(), cmd_get_response(), cmd_internal_authenticate(), cmd_manage_security_env(), cmd_pso_cds(), cmd_pso_decipher(), cmd_pso_decipher_aes(), cmd_put_data(), cmd_put_data_odd(), cmd_reset_retry_counter(), cmd_select(), cmd_terminate_df(), cmd_verify(), openpgp_process_apdu(), and put_data_algo_attr().