Reorganizing core0/core1 split.
Now CBOR and APDU (i.e., intensive processing) areas are executed on core1, while core0 is dedicated for hardware tasks (usb, button, led, etc.).
This commit is contained in:
@@ -22,14 +22,17 @@
|
||||
#include "ctap_hid.h"
|
||||
#include "fido.h"
|
||||
#include "hsm.h"
|
||||
#include "usb.h"
|
||||
#include "apdu.h"
|
||||
|
||||
const bool _btrue = true, _bfalse = false;
|
||||
|
||||
const uint8_t aaguid[16] = {0x89, 0xFB, 0x94, 0xB7, 0x06, 0xC9, 0x36, 0x73, 0x9B, 0x7E, 0x30, 0x52, 0x6D, 0x96, 0x81, 0x45}; // First 16 bytes of SHA256("Pico FIDO2")
|
||||
|
||||
int cbor_process(const uint8_t *data, size_t len) {
|
||||
if (scan_files() != CCID_OK)
|
||||
return -CTAP1_ERR_OTHER;
|
||||
const uint8_t *cbor_data = NULL;
|
||||
size_t cbor_len = 0;
|
||||
|
||||
int cbor_parse(const uint8_t *data, size_t len) {
|
||||
if (len == 0)
|
||||
return -CTAP1_ERR_INVALID_LEN;
|
||||
driver_prepare_response();
|
||||
@@ -40,6 +43,33 @@ int cbor_process(const uint8_t *data, size_t len) {
|
||||
else if (data[0] == CTAP_RESET)
|
||||
return cbor_reset();
|
||||
else if (data[0] == CTAP_CLIENT_PIN)
|
||||
return cbor_client_pin(data+1, len-1);
|
||||
return cbor_client_pin(data + 1, len - 1);
|
||||
return -CTAP2_ERR_INVALID_CBOR;
|
||||
}
|
||||
|
||||
void cbor_thread() {
|
||||
|
||||
while (1) {
|
||||
uint32_t m;
|
||||
queue_remove_blocking(&usb_to_card_q, &m);
|
||||
|
||||
if (m == EV_EXIT) {
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
apdu.sw = cbor_parse(cbor_data, cbor_len);
|
||||
|
||||
finished_data_size = res_APDU_size+1;
|
||||
uint32_t flag = EV_EXEC_FINISHED;
|
||||
queue_add_blocking(&card_to_usb_q, &flag);
|
||||
}
|
||||
}
|
||||
|
||||
int cbor_process(const uint8_t *data, size_t len) {
|
||||
cbor_data = data;
|
||||
cbor_len = len;
|
||||
res_APDU = ctap_resp->init.data + 1;
|
||||
res_APDU_size = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user