Your answer solved my problem.But When I write print into the task, gives me same error.
Full Code:
Code: Select all
mbedtls_aes_context aes;
size_t _length = 16;
unsigned char iv[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
unsigned char key[16] = {0xff, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
unsigned char input[16] = "HelloEsp32AES**"; // 15 Chars + 1 (NULL)
unsigned char encrypt_output[48];
unsigned char decrypt_output[48];
TaskHandle_t xHandle;
void task(void* p)
{
memset(encrypt_output, 0, 48);
memset(decrypt_output, 0, 48);
size_t iv_offset = 0;
mbedtls_aes_init(&aes);
mbedtls_aes_setkey_enc(&aes, key, 128);
mbedtls_aes_crypt_cfb128(&aes, MBEDTLS_AES_ENCRYPT, 128, &iv_offset, iv, input, encrypt_output);
mbedtls_aes_free(&aes);
for(int i = 0; i < 48; i++) //
{
printf(":%d", (int)encrypt_output[i]); <= Print statement causing the fault.
}
printf("\n");
while(1){
vTaskDelay(100);
}
}
void app_main()
{
int temp = nvs_flash_init();
if (temp == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
temp = nvs_flash_init();
}
xTaskCreate(task, "task", 1024*10, NULL, 5, &xHandle);
}
Error:
Code: Select all
Guru Meditation Error: Core 1 panic'ed (StoreProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x40085031 PS : 0x00060b33 A0 : 0x800868e9 A1 : 0x3ffc8eb0
A2 : 0xfcbece63 A3 : 0x00000000 A4 : 0x00060023 A5 : 0x3ffc7948
A6 : 0x00000001 A7 : 0x00000001 A8 : 0x0000abab A9 : 0x0000abab
A10 : 0xb33fffff A11 : 0x0000cdcd A12 : 0x00060020 A13 : 0x00000001
A14 : 0x00060b23 A15 : 0x00000000 SAR : 0x00000008 EXCCAUSE: 0x0000001d
EXCVADDR: 0xfcbece63 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xffffffff
Backtrace: 0x40085031:0x3ffc8eb0 0x400868e6:0x3ffc8ed0 0x40082680:0x3ffc8ef0 0x400826b1:0x3ffc8f10 0x40082b51:0x3ffc8f30 0x4000beaf:0x3ffc8f50 0x400840f2:0x3ffc8f70 0x40084324:0x3ffc8f90 0x40082bf6:0x3ffc8fb0 0x40082c1c:0x3ffc8fd0 0x40082d61:0x3ffc9000 0x400d89d6:0x3ffc9020 0x400d26e5:0x3ffc9330 0x400d2171:0x3ffc9380
Rebooting...
ets Jun 8 2016 00:22:57