|
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_fido2::cbor_writer_t |
| struct | cdc::mod_fido2::cbor_reader_t |
| struct | cdc::mod_fido2::cbor_item_t |
Namespaces | |
| namespace | cdc |
| namespace | cdc::mod_fido2 |
Macros | |
| #define | CBOR_UNSIGNED 0 |
| #define | CBOR_NEGATIVE 1 |
| #define | CBOR_BYTES 2 |
| #define | CBOR_TEXT 3 |
| #define | CBOR_ARRAY 4 |
| #define | CBOR_MAP 5 |
| #define | CBOR_TAG 6 |
| #define | CBOR_SIMPLE 7 |
| #define | CBOR_FALSE 0xF4 |
| #define | CBOR_TRUE 0xF5 |
| #define | CBOR_NULL 0xF6 |
| #define | CBOR_UNDEFINED 0xF7 |
Functions | |
| void | cdc::mod_fido2::cbor_writer_init (cbor_writer_t *w, uint8_t *buffer, size_t size) |
| size_t | cdc::mod_fido2::cbor_writer_length (const cbor_writer_t *w) |
| bool | cdc::mod_fido2::cbor_writer_error (const cbor_writer_t *w) |
| void | cdc::mod_fido2::cbor_encode_uint (cbor_writer_t *w, uint64_t value) |
| void | cdc::mod_fido2::cbor_encode_int (cbor_writer_t *w, int64_t value) |
| void | cdc::mod_fido2::cbor_encode_bytes (cbor_writer_t *w, const uint8_t *data, size_t len) |
| void | cdc::mod_fido2::cbor_encode_text (cbor_writer_t *w, const char *str) |
| void | cdc::mod_fido2::cbor_encode_text_len (cbor_writer_t *w, const char *str, size_t len) |
| void | cdc::mod_fido2::cbor_encode_bool (cbor_writer_t *w, bool value) |
| void | cdc::mod_fido2::cbor_encode_null (cbor_writer_t *w) |
| void | cdc::mod_fido2::cbor_encode_array (cbor_writer_t *w, size_t count) |
| void | cdc::mod_fido2::cbor_encode_map (cbor_writer_t *w, size_t count) |
| void | cdc::mod_fido2::cbor_encode_cose_key_p256 (cbor_writer_t *w, const uint8_t *x, const uint8_t *y) |
| void | cdc::mod_fido2::cbor_encode_cose_key_ed25519 (cbor_writer_t *w, const uint8_t *pubkey) |
| void | cbor_reader_init (cbor_reader_t *r, const uint8_t *data, size_t size) |
| CBOR reader implementation. | |
| bool | cbor_reader_error (const cbor_reader_t *r) |
| Returns whether reader is in error state. | |
| bool | cbor_reader_available (const cbor_reader_t *r) |
| Returns whether unread data remains. | |
| int | cbor_reader_peek_type (const cbor_reader_t *r) |
| Peeks major type of next CBOR item. | |
| bool | cbor_read_item (cbor_reader_t *r, cbor_item_t *item) |
| Reads next CBOR item metadata and optional inline payload pointer. | |
| bool | cbor_read_uint (cbor_reader_t *r, uint64_t *value) |
| Reads CBOR unsigned integer. | |
| bool | cbor_read_int (cbor_reader_t *r, int64_t *value) |
| Reads CBOR integer (positive or negative). | |
| bool | cbor_read_bytes (cbor_reader_t *r, uint8_t *out, size_t max_len, size_t *out_len) |
| Reads CBOR byte-string into optional output buffer. | |
| bool | cbor_read_text (cbor_reader_t *r, char *out, size_t max_len, size_t *out_len) |
| Reads CBOR text string into output buffer. | |
| bool | cbor_read_bool (cbor_reader_t *r, bool *value) |
| Reads CBOR boolean simple value. | |
| int | cbor_read_map (cbor_reader_t *r) |
| Reads CBOR map header and returns pair count. | |
| int | cbor_read_array (cbor_reader_t *r) |
| Reads CBOR array header and returns element count. | |
| bool | cbor_skip_item (cbor_reader_t *r) |
| Skips one complete CBOR item including nested container content. | |
| bool | cbor_parse_cose_key (cbor_reader_t *r, int *kty, int *alg, uint8_t *x, uint8_t *y) |
| Parses COSE key map and extracts key type, algorithm, and coordinates. | |
| #define CBOR_ARRAY 4 |
Definition at line 21 of file cbor_helpers.h.
Referenced by cbor_encode_array(), cbor_read_array(), and cbor_skip_item_impl().
| #define CBOR_BYTES 2 |
Definition at line 19 of file cbor_helpers.h.
Referenced by cbor_encode_bytes(), cbor_read_bytes(), and cbor_read_item().
| #define CBOR_FALSE 0xF4 |
Definition at line 27 of file cbor_helpers.h.
Referenced by cbor_encode_bool(), and cbor_read_bool().
| #define CBOR_MAP 5 |
Definition at line 22 of file cbor_helpers.h.
Referenced by cbor_encode_map(), cbor_read_map(), and cbor_skip_item_impl().
| #define CBOR_NEGATIVE 1 |
Definition at line 18 of file cbor_helpers.h.
Referenced by cbor_encode_int(), cbor_read_int(), client_pin_get_pin_token(), and client_pin_get_pin_uv_auth_token().
| #define CBOR_NULL 0xF6 |
Definition at line 29 of file cbor_helpers.h.
Referenced by cbor_encode_null().
| #define CBOR_SIMPLE 7 |
Definition at line 24 of file cbor_helpers.h.
| #define CBOR_TAG 6 |
Definition at line 23 of file cbor_helpers.h.
| #define CBOR_TEXT 3 |
Definition at line 20 of file cbor_helpers.h.
Referenced by cbor_encode_text(), cbor_encode_text_len(), cbor_read_item(), and cbor_read_text().
| #define CBOR_TRUE 0xF5 |
Definition at line 28 of file cbor_helpers.h.
Referenced by cbor_encode_bool(), and cbor_read_bool().
| #define CBOR_UNDEFINED 0xF7 |
Definition at line 30 of file cbor_helpers.h.
| #define CBOR_UNSIGNED 0 |
Definition at line 17 of file cbor_helpers.h.
Referenced by cbor_encode_int(), cbor_encode_uint(), cbor_read_int(), cbor_read_uint(), client_pin_get_pin_token(), and client_pin_get_pin_uv_auth_token().
| bool cbor_parse_cose_key | ( | cbor_reader_t * | r, |
| int * | kty, | ||
| int * | alg, | ||
| uint8_t * | x, | ||
| uint8_t * | y ) |
Parses COSE key map and extracts key type, algorithm, and coordinates.
Parse COSE_Key from CBOR.
| r | Reader context (positioned at key map) |
| kty | Output: key type (1=OKP, 2=EC2) |
| alg | Output: algorithm |
| x | Output: X coordinate (32 bytes) |
| y | Output: Y coordinate (32 bytes, NULL for OKP) |
| r | Reader context positioned at COSE key map. |
| kty | Output key type. |
| alg | Output algorithm identifier. |
| x | Output x-coordinate/public key bytes. |
| y | Optional output y-coordinate bytes. |
Definition at line 613 of file cbor_helpers.cpp.
References cbor_read_bytes(), cbor_read_int(), cbor_read_map(), cbor_read_uint(), and cbor_skip_item().
| int cbor_read_array | ( | cbor_reader_t * | r | ) |
Reads CBOR array header and returns element count.
Read array header and return item count.
| r | Reader context. |
Definition at line 549 of file cbor_helpers.cpp.
References CBOR_ARRAY, and cbor_read_item().
Referenced by ga_parse_allow_list(), and cdc::mod_fido2::parse_pubkey_cred_params().
| bool cbor_read_bool | ( | cbor_reader_t * | r, |
| bool * | value ) |
Reads CBOR boolean simple value.
Read boolean value.
| r | Reader context. |
| value | Output boolean. |
Definition at line 513 of file cbor_helpers.cpp.
References CBOR_FALSE, CBOR_TRUE, and read_byte().
Referenced by ga_parse_options(), and cdc::mod_fido2::parse_options_map().
| bool cbor_read_bytes | ( | cbor_reader_t * | r, |
| uint8_t * | out, | ||
| size_t | max_len, | ||
| size_t * | out_len ) |
Reads CBOR byte-string into optional output buffer.
Read byte string.
| r | Reader context |
| out | Output buffer |
| max_len | Maximum length |
| out_len | Actual length |
| r | Reader context. |
| out | Optional output data buffer. |
| max_len | Output capacity. |
| out_len | Optional output original item length. |
Definition at line 462 of file cbor_helpers.cpp.
References CBOR_BYTES, and cbor_read_item().
Referenced by cbor_parse_cose_key(), client_pin_get_pin_token(), client_pin_get_pin_uv_auth_token(), ctap2_cred_management(), ga_parse_allow_list_credential(), ga_parse_params(), cdc::mod_fido2::parse_make_credential_params(), and cdc::mod_fido2::parse_user_map().
| bool cbor_read_int | ( | cbor_reader_t * | r, |
| int64_t * | value ) |
Reads CBOR integer (positive or negative).
Read signed integer.
| r | Reader context. |
| value | Output value. |
Definition at line 439 of file cbor_helpers.cpp.
References CBOR_NEGATIVE, cbor_read_item(), and CBOR_UNSIGNED.
Referenced by cbor_parse_cose_key(), and cdc::mod_fido2::parse_pubkey_cred_params().
| bool cbor_read_item | ( | cbor_reader_t * | r, |
| cbor_item_t * | item ) |
Reads next CBOR item metadata and optional inline payload pointer.
Read next CBOR item.
| r | Reader context |
| item | Output item |
| r | Reader context. |
| item | Output item descriptor. |
Definition at line 391 of file cbor_helpers.cpp.
References CBOR_BYTES, CBOR_TEXT, and read_type_value().
Referenced by cbor_read_array(), cbor_read_bytes(), cbor_read_int(), cbor_read_map(), cbor_read_text(), cbor_read_uint(), cbor_skip_item_impl(), client_pin_get_pin_token(), and client_pin_get_pin_uv_auth_token().
| int cbor_read_map | ( | cbor_reader_t * | r | ) |
Reads CBOR map header and returns pair count.
Read map header and return item count.
| r | Reader context. |
Definition at line 534 of file cbor_helpers.cpp.
References CBOR_MAP, and cbor_read_item().
Referenced by cbor_parse_cose_key(), client_pin_get_pin_token(), client_pin_get_pin_uv_auth_token(), ctap2_client_pin(), ctap2_cred_management(), ga_parse_allow_list_credential(), ga_parse_extensions(), ga_parse_options(), ga_parse_params(), cdc::mod_fido2::parse_extensions_map(), cdc::mod_fido2::parse_make_credential_params(), cdc::mod_fido2::parse_options_map(), cdc::mod_fido2::parse_pubkey_cred_params(), cdc::mod_fido2::parse_rp_map(), and cdc::mod_fido2::parse_user_map().
| bool cbor_read_text | ( | cbor_reader_t * | r, |
| char * | out, | ||
| size_t | max_len, | ||
| size_t * | out_len ) |
Reads CBOR text string into output buffer.
Read text string.
| r | Reader context |
| out | Output buffer (null-terminated) |
| max_len | Maximum length including null |
| out_len | Actual length excluding null |
| r | Reader context. |
| out | Output text buffer. |
| max_len | Output capacity including terminator. |
| out_len | Optional output original text length. |
Definition at line 486 of file cbor_helpers.cpp.
References cbor_read_item(), and CBOR_TEXT.
Referenced by client_pin_get_pin_uv_auth_token(), ctap2_cred_management(), ga_parse_allow_list_credential(), ga_parse_extensions(), ga_parse_options(), ga_parse_params(), cdc::mod_fido2::parse_extensions_map(), cdc::mod_fido2::parse_options_map(), cdc::mod_fido2::parse_pubkey_cred_params(), cdc::mod_fido2::parse_rp_map(), and cdc::mod_fido2::parse_user_map().
| bool cbor_read_uint | ( | cbor_reader_t * | r, |
| uint64_t * | value ) |
Reads CBOR unsigned integer.
Read unsigned integer.
| r | Reader context. |
| value | Output value. |
Definition at line 422 of file cbor_helpers.cpp.
References cbor_read_item(), and CBOR_UNSIGNED.
Referenced by cbor_parse_cose_key(), client_pin_get_pin_token(), client_pin_get_pin_uv_auth_token(), ctap2_client_pin(), ctap2_cred_management(), ga_parse_params(), cdc::mod_fido2::parse_extensions_map(), and cdc::mod_fido2::parse_make_credential_params().
| bool cbor_reader_available | ( | const cbor_reader_t * | r | ) |
Returns whether unread data remains.
Check if more data available.
| r | Reader context. |
Definition at line 300 of file cbor_helpers.cpp.
| bool cbor_reader_error | ( | const cbor_reader_t * | r | ) |
Returns whether reader is in error state.
Check for read errors.
| r | Reader context. |
Definition at line 291 of file cbor_helpers.cpp.
| void cbor_reader_init | ( | cbor_reader_t * | r, |
| const uint8_t * | data, | ||
| size_t | size ) |
CBOR reader implementation.
Initialize CBOR reader.
| r | Reader context |
| data | Input data |
| size | Data size |
Initializes CBOR reader state.
| r | Reader context. |
| data | Input buffer. |
| size | Input size. |
Definition at line 279 of file cbor_helpers.cpp.
Referenced by client_pin_get_pin_token(), client_pin_get_pin_uv_auth_token(), ctap2_client_pin(), ctap2_cred_management(), ga_parse_params(), and cdc::mod_fido2::parse_make_credential_params().
| int cbor_reader_peek_type | ( | const cbor_reader_t * | r | ) |
Peeks major type of next CBOR item.
Peek at next item type without consuming.
| r | Reader context. |
Definition at line 309 of file cbor_helpers.cpp.
| bool cbor_skip_item | ( | cbor_reader_t * | r | ) |
Skips one complete CBOR item including nested container content.
Skip the next CBOR item (including nested containers).
| r | Reader context. |
Definition at line 600 of file cbor_helpers.cpp.
References cbor_skip_item_impl().
Referenced by cbor_parse_cose_key(), client_pin_get_pin_token(), client_pin_get_pin_uv_auth_token(), ctap2_client_pin(), ctap2_cred_management(), ga_parse_allow_list_credential(), ga_parse_extensions(), ga_parse_options(), ga_parse_params(), cdc::mod_fido2::parse_extensions_map(), cdc::mod_fido2::parse_make_credential_params(), cdc::mod_fido2::parse_options_map(), cdc::mod_fido2::parse_pubkey_cred_params(), cdc::mod_fido2::parse_rp_map(), and cdc::mod_fido2::parse_user_map().