Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AES] Timeout: return error dont abort (IDFGH-9265) #10648

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions components/mbedtls/port/aes/dma/esp_aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ static esp_err_t esp_aes_isr_initialise( void )
#endif // CONFIG_MBEDTLS_AES_USE_INTERRUPT

/* Wait for AES hardware block operation to complete */
static void esp_aes_dma_wait_complete(bool use_intr, lldesc_t *output_desc)
static int esp_aes_dma_wait_complete(bool use_intr, lldesc_t *output_desc)
{
#if defined (CONFIG_MBEDTLS_AES_USE_INTERRUPT)
if (use_intr) {
if (!xSemaphoreTake(op_complete_sem, 2000 / portTICK_PERIOD_MS)) {
if (!xSemaphoreTake(op_complete_sem, 5000 / portTICK_PERIOD_MS)) {
/* indicates a fundamental problem with driver */
ESP_LOGE("AES", "Timed out waiting for completion of AES Interrupt");
abort();
return -1;
}
#ifdef CONFIG_PM_ENABLE
esp_pm_lock_release(s_pm_cpu_lock);
Expand All @@ -230,6 +230,7 @@ static void esp_aes_dma_wait_complete(bool use_intr, lldesc_t *output_desc)
aes_hal_wait_done();

esp_aes_wait_dma_done(output_desc);
return 0;
}


Expand Down Expand Up @@ -436,7 +437,12 @@ static int esp_aes_process_dma(esp_aes_context *ctx, const unsigned char *input,
}

aes_hal_transform_dma_start(blocks);
esp_aes_dma_wait_complete(use_intr, out_desc_tail);

if (esp_aes_dma_wait_complete(use_intr, out_desc_tail) < 0) {
ESP_LOGE(TAG, "esp_aes_dma_wait_complete failed");
ret = -1;
goto cleanup;
}

#if (CONFIG_SPIRAM && SOC_PSRAM_DMA_CAPABLE)
if (block_bytes > 0) {
Expand Down Expand Up @@ -561,7 +567,11 @@ int esp_aes_process_dma_gcm(esp_aes_context *ctx, const unsigned char *input, un

aes_hal_transform_dma_gcm_start(blocks);

esp_aes_dma_wait_complete(use_intr, out_desc_head);
if(esp_aes_dma_wait_complete(use_intr, out_desc_head) < 0){
ESP_LOGE(TAG, "esp_aes_dma_wait_complete failed");
ret = -1;
goto cleanup;
}

aes_hal_transform_dma_finish();

Expand Down