From 6625678c3059554ef9fc38c1fd0ff16fa4dbad3e Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Tue, 5 Nov 2024 18:21:24 +0100 Subject: [PATCH] Rename CCID_ codes to PICOKEY_ Signed-off-by: Pol Henarejos --- src/apdu.c | 2 +- src/asn1.c | 6 +++--- src/crypto_utils.c | 4 ++-- src/eac.c | 28 +++++++++++++------------- src/fs/file.c | 48 ++++++++++++++++++++++----------------------- src/fs/flash.c | 14 ++++++------- src/fs/low_flash.c | 14 ++++++------- src/fs/phy.c | 12 ++++++------ src/main.c | 10 +++++----- src/pico_keys.h | 28 +++++++++++++------------- src/rescue.c | 6 +++--- src/usb/ccid/ccid.c | 6 +++--- src/usb/hid/hid.c | 4 ++-- src/usb/usb.c | 8 ++++---- 14 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/apdu.c b/src/apdu.c index 34c4742..fd41df2 100644 --- a/src/apdu.c +++ b/src/apdu.c @@ -56,7 +56,7 @@ int process_apdu() { } } if (INS(apdu) == 0xA4 && P1(apdu) == 0x04 && (P2(apdu) == 0x00 || P2(apdu) == 0x4)) { //select by AID - if (select_app(apdu.data, apdu.nc) == CCID_OK) { + if (select_app(apdu.data, apdu.nc) == PICOKEY_OK) { return SW_OK(); } return SW_FILE_NOT_FOUND(); diff --git a/src/asn1.c b/src/asn1.c index 29937c2..ad52ee4 100644 --- a/src/asn1.c +++ b/src/asn1.c @@ -20,17 +20,17 @@ int asn1_ctx_init(uint8_t *data, uint16_t len, asn1_ctx_t *ctx) { if (!ctx) { - return CCID_ERR_NULL_PARAM; + return PICOKEY_ERR_NULL_PARAM; } ctx->data = data; ctx->len = len; - return CCID_OK; + return PICOKEY_OK; } int asn1_ctx_clear(asn1_ctx_t *ctx) { ctx->data = NULL; ctx->len = 0; - return CCID_OK; + return PICOKEY_OK; } uint16_t asn1_len(asn1_ctx_t *ctx) { diff --git a/src/crypto_utils.c b/src/crypto_utils.c index bafdeea..3a43601 100644 --- a/src/crypto_utils.c +++ b/src/crypto_utils.c @@ -82,7 +82,7 @@ int aes_encrypt(const uint8_t *key, const uint8_t *iv, uint16_t key_size, int mo } int r = mbedtls_aes_setkey_enc(&aes, key, key_size); if (r != 0) { - return CCID_EXEC_ERROR; + return PICOKEY_EXEC_ERROR; } if (mode == PICO_KEYS_AES_MODE_CBC) { return mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_ENCRYPT, len, tmp_iv, data, data); @@ -101,7 +101,7 @@ int aes_decrypt(const uint8_t *key, const uint8_t *iv, uint16_t key_size, int mo } int r = mbedtls_aes_setkey_dec(&aes, key, key_size); if (r != 0) { - return CCID_EXEC_ERROR; + return PICOKEY_EXEC_ERROR; } if (mode == PICO_KEYS_AES_MODE_CBC) { return mbedtls_aes_crypt_cbc(&aes, MBEDTLS_AES_DECRYPT, len, tmp_iv, data, data); diff --git a/src/eac.c b/src/eac.c index 7fef272..824eb96 100644 --- a/src/eac.c +++ b/src/eac.c @@ -97,10 +97,10 @@ int sm_sign(uint8_t *in, size_t in_len, uint8_t *out) { int sm_unwrap() { uint8_t sm_indicator = (CLA(apdu) >> 2) & 0x3; if (sm_indicator == 0) { - return CCID_OK; + return PICOKEY_OK; } int r = sm_verify(); - if (r != CCID_OK) { + if (r != PICOKEY_OK) { return r; } apdu.ne = sm_get_le(); @@ -126,23 +126,23 @@ int sm_unwrap() { } if (!body) { apdu.nc = 0; - return CCID_OK; + return PICOKEY_OK; } if (is87 && *body++ != 0x1) { - return CCID_WRONG_PADDING; + return PICOKEY_WRONG_PADDING; } sm_update_iv(); aes_decrypt(sm_kenc, sm_iv, 128, PICO_KEYS_AES_MODE_CBC, body, body_size); memmove(apdu.data, body, body_size); apdu.nc = sm_remove_padding(apdu.data, body_size); DEBUG_PAYLOAD(apdu.data, (int) apdu.nc); - return CCID_OK; + return PICOKEY_OK; } int sm_wrap() { uint8_t sm_indicator = (CLA(apdu) >> 2) & 0x3; if (sm_indicator == 0) { - return CCID_OK; + return PICOKEY_OK; } uint8_t input[4096]; size_t input_len = 0; @@ -153,7 +153,7 @@ int sm_wrap() { mbedtls_mpi_copy(&sm_mSSC, &ssc); int r = mbedtls_mpi_write_binary(&ssc, input, sm_blocksize); if (r != 0) { - return CCID_EXEC_ERROR; + return PICOKEY_EXEC_ERROR; } input_len += sm_blocksize; mbedtls_mpi_free(&ssc); @@ -203,7 +203,7 @@ int sm_wrap() { apdu.ne = res_APDU_size; } set_res_sw(0x90, 0x00); - return CCID_OK; + return PICOKEY_OK; } uint16_t sm_get_le() { @@ -243,7 +243,7 @@ int sm_verify() { data_len += sm_blocksize; } if (data_len + (add_header ? sm_blocksize : 0) > 4096) { - return CCID_WRONG_LENGTH; + return PICOKEY_WRONG_LENGTH; } mbedtls_mpi ssc; mbedtls_mpi_init(&ssc); @@ -253,7 +253,7 @@ int sm_verify() { input_len += sm_blocksize; mbedtls_mpi_free(&ssc); if (r != 0) { - return CCID_EXEC_ERROR; + return PICOKEY_EXEC_ERROR; } if (add_header) { input[input_len++] = CLA(apdu); @@ -286,7 +286,7 @@ int sm_verify() { } } if (!mac) { - return CCID_WRONG_DATA; + return PICOKEY_WRONG_DATA; } if (some_added) { input[input_len++] = 0x80; @@ -295,12 +295,12 @@ int sm_verify() { uint8_t signature[16]; r = sm_sign(input, input_len, signature); if (r != 0) { - return CCID_EXEC_ERROR; + return PICOKEY_EXEC_ERROR; } if (memcmp(signature, mac, mac_len) == 0) { - return CCID_OK; + return PICOKEY_OK; } - return CCID_VERIFICATION_FAILED; + return PICOKEY_VERIFICATION_FAILED; } uint16_t sm_remove_padding(const uint8_t *data, uint16_t data_len) { diff --git a/src/fs/file.c b/src/fs/file.c index fa47599..d0f304f 100644 --- a/src/fs/file.c +++ b/src/fs/file.c @@ -332,7 +332,7 @@ file_t *search_dynamic_file(uint16_t fid) { int delete_dynamic_file(file_t *f) { if (f == NULL) { - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } for (int i = 0; i < dynamic_files; i++) { if (dynamic_file[i].fid == f->fid) { @@ -340,10 +340,10 @@ int delete_dynamic_file(file_t *f) { memcpy(&dynamic_file[j - 1], &dynamic_file[j], sizeof(file_t)); } dynamic_files--; - return CCID_OK; + return PICOKEY_OK; } } - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } file_t *file_new(uint16_t fid) { @@ -396,7 +396,7 @@ uint16_t meta_find(uint16_t fid, uint8_t **out) { int meta_delete(uint16_t fid) { file_t *ef = search_file(EF_META); if (!ef) { - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } uint16_t tag = 0x0; uint8_t *tag_data = NULL, *p = NULL; @@ -425,21 +425,21 @@ int meta_delete(uint16_t fid) { } int r = file_put_data(ef, fdata, new_len); free(fdata); - if (r != CCID_OK) { - return CCID_EXEC_ERROR; + if (r != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } } low_flash_available(); break; } } - return CCID_OK; + return PICOKEY_OK; } int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { int r; file_t *ef = search_file(EF_META); if (!ef) { - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } uint16_t ef_size = file_get_size(ef); uint8_t *fdata = (uint8_t *) calloc(1, ef_size); @@ -459,10 +459,10 @@ int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { memcpy(p - tag_len + 2, data, len); r = file_put_data(ef, fdata, ef_size); free(fdata); - if (r != CCID_OK) { - return CCID_EXEC_ERROR; + if (r != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } - return CCID_OK; + return PICOKEY_OK; } else { //needs reallocation uint8_t *tpos = p - asn1_len_tag(tag, tag_len); @@ -477,7 +477,7 @@ int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { } else { free(fdata); - return CCID_ERR_MEMORY_FATAL; + return PICOKEY_ERR_MEMORY_FATAL; } } uint8_t *f = fdata + meta_offset; @@ -488,10 +488,10 @@ int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { memcpy(f, data, len); r = file_put_data(ef, fdata, ef_size); free(fdata); - if (r != CCID_OK) { - return CCID_EXEC_ERROR; + if (r != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } - return CCID_OK; + return PICOKEY_OK; } } } @@ -504,10 +504,10 @@ int meta_add(uint16_t fid, const uint8_t *data, uint16_t len) { memcpy(f, data, len); r = file_put_data(ef, fdata, ef_size + (uint16_t)asn1_len_tag(fid & 0x1f, len + 2)); free(fdata); - if (r != CCID_OK) { - return CCID_EXEC_ERROR; + if (r != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } - return CCID_OK; + return PICOKEY_OK; } bool file_has_data(file_t *f) { @@ -516,15 +516,15 @@ bool file_has_data(file_t *f) { int delete_file(file_t *ef) { if (ef == NULL) { - return CCID_OK; + return PICOKEY_OK; } meta_delete(ef->fid); - if (flash_clear_file(ef) != CCID_OK) { - return CCID_EXEC_ERROR; + if (flash_clear_file(ef) != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } - if (delete_dynamic_file(ef) != CCID_OK) { - return CCID_EXEC_ERROR; + if (delete_dynamic_file(ef) != PICOKEY_OK) { + return PICOKEY_EXEC_ERROR; } low_flash_available(); - return CCID_OK; + return PICOKEY_OK; } diff --git a/src/fs/flash.c b/src/fs/flash.c index 466e710..96dd091 100644 --- a/src/fs/flash.c +++ b/src/fs/flash.c @@ -128,7 +128,7 @@ uintptr_t allocate_free_addr(uint16_t size, bool persistent) { int flash_clear_file(file_t *file) { if (file == NULL || file->data == NULL) { - return CCID_OK; + return PICOKEY_OK; } uintptr_t base_addr = (uintptr_t)(file->data - sizeof(uintptr_t) - sizeof(uint16_t) - sizeof(uintptr_t)); @@ -144,18 +144,18 @@ int flash_clear_file(file_t *file) { flash_program_uintptr(base_addr + sizeof(uintptr_t), 0); file->data = NULL; //printf("na %lx->%lx\n",prev_addr,flash_read_uintptr(prev_addr)); - return CCID_OK; + return PICOKEY_OK; } int flash_write_data_to_file_offset(file_t *file, const uint8_t *data, uint16_t len, uint16_t offset) { if (!file) { - return CCID_ERR_NULL_PARAM; + return PICOKEY_ERR_NULL_PARAM; } uint16_t size_file_flash = file->data ? flash_read_uint16((uintptr_t) file->data) : 0; uint8_t *old_data = NULL; if (offset + len > FLASH_SECTOR_SIZE || offset > size_file_flash) { - return CCID_ERR_NO_MEMORY; + return PICOKEY_ERR_NO_MEMORY; } if (file->data) { //already in flash if (offset + len <= size_file_flash) { //it fits, no need to move it @@ -163,7 +163,7 @@ int flash_write_data_to_file_offset(file_t *file, const uint8_t *data, uint16_t if (data) { flash_program_block((uintptr_t) file->data + sizeof(uint16_t) + offset, data, len); } - return CCID_OK; + return PICOKEY_OK; } else { //we clear the old file flash_clear_file(file); @@ -180,7 +180,7 @@ int flash_write_data_to_file_offset(file_t *file, const uint8_t *data, uint16_t uintptr_t new_addr = allocate_free_addr(len, (file->type & FILE_PERSISTENT) == FILE_PERSISTENT); //printf("na %x\n",new_addr); if (new_addr == 0x0) { - return CCID_ERR_NO_MEMORY; + return PICOKEY_ERR_NO_MEMORY; } file->data = (uint8_t *) new_addr + sizeof(uintptr_t) + sizeof(uint16_t) + sizeof(uintptr_t); //next addr+fid+prev addr flash_program_halfword(new_addr + sizeof(uintptr_t) + sizeof(uintptr_t), file->fid); @@ -191,7 +191,7 @@ int flash_write_data_to_file_offset(file_t *file, const uint8_t *data, uint16_t if (old_data) { free(old_data); } - return CCID_OK; + return PICOKEY_OK; } int flash_write_data_to_file(file_t *file, const uint8_t *data, uint16_t len) { return flash_write_data_to_file_offset(file, data, len, 0); diff --git a/src/fs/low_flash.c b/src/fs/low_flash.c index 72e6f5e..d62e2b0 100644 --- a/src/fs/low_flash.c +++ b/src/fs/low_flash.c @@ -224,24 +224,24 @@ int flash_program_block(uintptr_t addr, const uint8_t *data, size_t len) { page_flash_t *p = NULL; if (!data || len == 0) { - return CCID_ERR_NULL_PARAM; + return PICOKEY_ERR_NULL_PARAM; } mutex_enter_blocking(&mtx_flash); if (ready_pages == TOTAL_FLASH_PAGES) { mutex_exit(&mtx_flash); printf("ERROR: ALL FLASH PAGES CACHED\n"); - return CCID_ERR_NO_MEMORY; + return PICOKEY_ERR_NO_MEMORY; } if (!(p = find_free_page(addr))) { mutex_exit(&mtx_flash); printf("ERROR: FLASH CANNOT FIND A PAGE (rare error)\n"); - return CCID_ERR_MEMORY_FATAL; + return PICOKEY_ERR_MEMORY_FATAL; } memcpy(&p->page[addr & (FLASH_SECTOR_SIZE - 1)], data, len); //printf("Flash: modified page %X with data %x at [%x]\n",(uintptr_t)addr,(uintptr_t)data,addr&(FLASH_SECTOR_SIZE-1)); mutex_exit(&mtx_flash); - return CCID_OK; + return PICOKEY_OK; } int flash_program_halfword(uintptr_t addr, uint16_t data) { @@ -305,19 +305,19 @@ int flash_erase_page(uintptr_t addr, size_t page_size) { if (ready_pages == TOTAL_FLASH_PAGES) { mutex_exit(&mtx_flash); printf("ERROR: ALL FLASH PAGES CACHED\n"); - return CCID_ERR_NO_MEMORY; + return PICOKEY_ERR_NO_MEMORY; } if (!(p = find_free_page(addr))) { printf("ERROR: FLASH CANNOT FIND A PAGE (rare error)\n"); mutex_exit(&mtx_flash); - return CCID_ERR_MEMORY_FATAL; + return PICOKEY_ERR_MEMORY_FATAL; } p->erase = true; p->ready = false; p->page_size = page_size; mutex_exit(&mtx_flash); - return CCID_OK; + return PICOKEY_OK; } bool flash_check_blank(const uint8_t *p_start, size_t size) { diff --git a/src/fs/phy.c b/src/fs/phy.c index 8922220..48f6a60 100644 --- a/src/fs/phy.c +++ b/src/fs/phy.c @@ -24,7 +24,7 @@ phy_data_t phy_data; int phy_serialize_data(const phy_data_t *phy, uint8_t *data, uint16_t *len) { if (!phy || !data || !len) { - return CCID_ERR_NULL_PARAM; + return PICOKEY_ERR_NULL_PARAM; } uint8_t *p = data; if (phy->vidpid_present) { @@ -46,12 +46,12 @@ int phy_serialize_data(const phy_data_t *phy, uint8_t *data, uint16_t *len) { *p++ = phy->opts >> 8; *p++ = phy->opts & 0xff; *len = p - data; - return CCID_OK; + return PICOKEY_OK; } #include int phy_unserialize_data(const uint8_t *data, uint16_t len, phy_data_t *phy) { if (!phy || !data || !len) { - return CCID_ERR_NULL_PARAM; + return PICOKEY_ERR_NULL_PARAM; } memset(phy, 0, sizeof(phy_data_t)); const uint8_t *p = data; @@ -80,7 +80,7 @@ int phy_unserialize_data(const uint8_t *data, uint16_t len, phy_data_t *phy) { break; } } - return CCID_OK; + return PICOKEY_OK; } int phy_init() { @@ -89,11 +89,11 @@ int phy_init() { const uint8_t *data = file_get_data(ef_phy); DEBUG_DATA(data, file_get_size(ef_phy)); int ret = phy_unserialize_data(data, file_get_size(ef_phy), &phy_data); - if (ret != CCID_OK) { + if (ret != PICOKEY_OK) { return ret; } } - return CCID_OK; + return PICOKEY_OK; } #endif diff --git a/src/main.c b/src/main.c index ee75f25..8852e53 100644 --- a/src/main.c +++ b/src/main.c @@ -67,26 +67,26 @@ int register_app(int (*select_aid)(app_t *, uint8_t), const uint8_t *aid) { int select_app(const uint8_t *aid, size_t aid_len) { if (current_app && current_app->aid && (current_app->aid + 1 == aid || !memcmp(current_app->aid + 1, aid, aid_len))) { current_app->select_aid(current_app, 0); - return CCID_OK; + return PICOKEY_OK; } for (int a = 0; a < num_apps; a++) { if (!memcmp(apps[a].aid + 1, aid, MIN(aid_len, apps[a].aid[0]))) { if (current_app) { if (current_app->aid && !memcmp(current_app->aid + 1, aid, aid_len)) { current_app->select_aid(current_app, 1); - return CCID_OK; + return PICOKEY_OK; } if (current_app->unload) { current_app->unload(); } } current_app = &apps[a]; - if (current_app->select_aid(current_app, 1) == CCID_OK) { - return CCID_OK; + if (current_app->select_aid(current_app, 1) == PICOKEY_OK) { + return PICOKEY_OK; } } } - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } int (*button_pressed_cb)(uint8_t) = NULL; diff --git a/src/pico_keys.h b/src/pico_keys.h index 29dd609..f0d753f 100644 --- a/src/pico_keys.h +++ b/src/pico_keys.h @@ -139,20 +139,20 @@ extern uint32_t button_timeout; #define SW_OK() set_res_sw(0x90, 0x00) -#define CCID_OK 0 -#define CCID_ERR_NO_MEMORY -1000 -#define CCID_ERR_MEMORY_FATAL -1001 -#define CCID_ERR_NULL_PARAM -1002 -#define CCID_ERR_FILE_NOT_FOUND -1003 -#define CCID_ERR_BLOCKED -1004 -#define CCID_NO_LOGIN -1005 -#define CCID_EXEC_ERROR -1006 -#define CCID_WRONG_LENGTH -1007 -#define CCID_WRONG_DATA -1008 -#define CCID_WRONG_DKEK -1009 -#define CCID_WRONG_SIGNATURE -1010 -#define CCID_WRONG_PADDING -1011 -#define CCID_VERIFICATION_FAILED -1012 +#define PICOKEY_OK 0 +#define PICOKEY_ERR_NO_MEMORY -1000 +#define PICOKEY_ERR_MEMORY_FATAL -1001 +#define PICOKEY_ERR_NULL_PARAM -1002 +#define PICOKEY_ERR_FILE_NOT_FOUND -1003 +#define PICOKEY_ERR_BLOCKED -1004 +#define PICOKEY_NO_LOGIN -1005 +#define PICOKEY_EXEC_ERROR -1006 +#define PICOKEY_WRONG_LENGTH -1007 +#define PICOKEY_WRONG_DATA -1008 +#define PICOKEY_WRONG_DKEK -1009 +#define PICOKEY_WRONG_SIGNATURE -1010 +#define PICOKEY_WRONG_PADDING -1011 +#define PICOKEY_VERIFICATION_FAILED -1012 #if defined(ENABLE_EMULATION) || defined(ESP_PLATFORM) #define PICO_UNIQUE_BOARD_ID_SIZE_BYTES 8 diff --git a/src/rescue.c b/src/rescue.c index a513c7b..151050d 100644 --- a/src/rescue.c +++ b/src/rescue.c @@ -36,7 +36,7 @@ int rescue_select(app_t *a, uint8_t force) { if (force) { scan_flash(); } - return CCID_OK; + return PICOKEY_OK; } INITIALIZER ( rescue_ctor ) { @@ -44,7 +44,7 @@ INITIALIZER ( rescue_ctor ) { } int rescue_unload() { - return CCID_OK; + return PICOKEY_OK; } int cmd_write() { @@ -55,7 +55,7 @@ int cmd_write() { if (P1(apdu) == 0x1) { // PHY #ifndef ENABLE_EMULATION int ret = phy_unserialize_data(apdu.data, apdu.nc, &phy_data); - if (ret == CCID_OK) { + if (ret == PICOKEY_OK) { file_put_data(ef_phy, apdu.data, apdu.nc); } #endif diff --git a/src/usb/ccid/ccid.c b/src/usb/ccid/ccid.c index a273d0c..fc51996 100644 --- a/src/usb/ccid/ccid.c +++ b/src/usb/ccid/ccid.c @@ -130,7 +130,7 @@ int driver_init_ccid(uint8_t itf) { //ccid_tx[itf].w_ptr = ccid_tx[itf].r_ptr = 0; - return CCID_OK; + return PICOKEY_OK; } void tud_vendor_rx_cb(uint8_t itf) { @@ -302,10 +302,10 @@ void driver_exec_finished_cont_ccid(uint8_t itf, uint16_t size_next, uint16_t of void ccid_task() { for (int itf = 0; itf < ITF_SC_TOTAL; itf++) { int status = card_status(sc_itf_to_usb_itf(itf)); - if (status == CCID_OK) { + if (status == PICOKEY_OK) { driver_exec_finished_ccid(itf, finished_data_size); } - else if (status == CCID_ERR_BLOCKED) { + else if (status == PICOKEY_ERR_BLOCKED) { driver_exec_timeout_ccid(itf); } if (ccid_tx[itf].w_ptr > ccid_tx[itf].r_ptr) { diff --git a/src/usb/hid/hid.c b/src/usb/hid/hid.c index d8ed032..1350403 100644 --- a/src/usb/hid/hid.c +++ b/src/usb/hid/hid.c @@ -598,10 +598,10 @@ void hid_task() { driver_process_usb_nopacket_hid(); } int status = card_status(ITF_HID); - if (status == CCID_OK) { + if (status == PICOKEY_OK) { driver_exec_finished_hid(finished_data_size); } - else if (status == CCID_ERR_BLOCKED) { + else if (status == PICOKEY_ERR_BLOCKED) { send_keepalive(); } if (hid_tx[ITF_HID_CTAP].w_ptr > hid_tx[ITF_HID_CTAP].r_ptr && last_write_result[ITF_HID_CTAP] != WRITE_PENDING) { diff --git a/src/usb/usb.c b/src/usb/usb.c index 4c71ddd..86d9fb1 100644 --- a/src/usb/usb.c +++ b/src/usb/usb.c @@ -177,7 +177,7 @@ int card_status(uint8_t itf) { if (m == EV_EXEC_FINISHED) { timeout_stop(); led_set_mode(MODE_MOUNTED); - return CCID_OK; + return PICOKEY_OK; } #ifndef ENABLE_EMULATION else if (m == EV_PRESS_BUTTON) { @@ -185,16 +185,16 @@ int card_status(uint8_t itf) { queue_try_add(&usb_to_card_q, &flag); } #endif - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; } else { if (timeout > 0) { if (timeout + timeout_counter[itf] < board_millis()) { timeout = board_millis(); - return CCID_ERR_BLOCKED; + return PICOKEY_ERR_BLOCKED; } } } } - return CCID_ERR_FILE_NOT_FOUND; + return PICOKEY_ERR_FILE_NOT_FOUND; }