diff --git a/src/eac.c b/src/eac.c index 4630e89..bf5ca27 100644 --- a/src/eac.c +++ b/src/eac.c @@ -144,7 +144,7 @@ int sm_wrap() { if (sm_indicator == 0) { return PICOKEY_OK; } - uint8_t input[4096]; + uint8_t input[2048]; size_t input_len = 0; memset(input, 0, sizeof(input)); mbedtls_mpi ssc; @@ -232,7 +232,7 @@ void sm_update_iv() { } int sm_verify() { - uint8_t input[4096]; + uint8_t input[2048]; memset(input, 0, sizeof(input)); uint16_t input_len = 0; int r = 0; @@ -241,7 +241,7 @@ int sm_verify() { if (data_len % sm_blocksize) { data_len += sm_blocksize; } - if (data_len + (add_header ? sm_blocksize : 0) > 4096) { + if (data_len + (add_header ? sm_blocksize : 0) > sizeof(input)) { return PICOKEY_WRONG_LENGTH; } mbedtls_mpi ssc; diff --git a/src/esp_compat.h b/src/esp_compat.h index 6266058..53e78e3 100644 --- a/src/esp_compat.h +++ b/src/esp_compat.h @@ -30,7 +30,7 @@ typedef QueueHandle_t queue_t; #define queue_is_empty(a) (uxQueueMessagesWaiting(*(a)) == 0) #define queue_try_remove(a,b) xQueueReceive(*(a), b, 0) extern TaskHandle_t hcore0, hcore1; -#define multicore_launch_core1(a) xTaskCreatePinnedToCore((void(*)(void *))a, "core1", 4096*5, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 2, &hcore1, 1) +#define multicore_launch_core1(a) xTaskCreatePinnedToCore((void(*)(void *))a, "core1", 4096*ITF_TOTAL*2, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 2, &hcore1, 1) #define multicore_reset_core1() do { if (hcore1) { eTaskState e = eTaskGetState(hcore1); if (e <= eSuspended) { vTaskDelete(hcore1); }} }while(0) #define sleep_ms(a) vTaskDelay(a / portTICK_PERIOD_MS) static inline uint32_t board_millis(void) { diff --git a/src/main.c b/src/main.c index d2ff294..d4cb909 100644 --- a/src/main.c +++ b/src/main.c @@ -342,7 +342,7 @@ int main(void) { #endif #ifdef ESP_PLATFORM - xTaskCreatePinnedToCore(core0_loop, "core0", 4096*5, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 1, &hcore0, 0); + xTaskCreatePinnedToCore(core0_loop, "core0", 4096*ITF_TOTAL*2, NULL, CONFIG_TINYUSB_TASK_PRIORITY - 1, &hcore0, 0); #else core0_loop(); #endif diff --git a/src/usb/tusb_config.h b/src/usb/tusb_config.h index 141ec36..1fabfa4 100644 --- a/src/usb/tusb_config.h +++ b/src/usb/tusb_config.h @@ -99,7 +99,7 @@ extern "C" { #endif #define CFG_TUD_VENDOR_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64) -#define CFG_TUD_VENDOR_TX_BUFSIZE 4096 +#define CFG_TUD_VENDOR_TX_BUFSIZE 2048 //------------- CLASS -------------// #define CFG_TUD_CDC 0