Flash encryption effect on ESP32 speed

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Flash encryption effect on ESP32 speed

Postby Vader_Mester » Tue Dec 12, 2017 1:18 pm

Hello Fellow Forumers,

Does anyone have actual data, information or insight on how much would flash encryption and secure boot slow down the ESP32?

Thanks for the answers in advance!

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Flash encryption effect on ESP32 speed

Postby ESP_Angus » Wed Dec 13, 2017 5:44 am

Hi Vader,

Secure Boot adds additional boot time when the app starts from reset, approximately +600ms. This is because the bootloader needs to calculate & verify two ECDHE signatures (partition table and app). We're looking at ways to reduce this overhead. After the app starts, secure boot adds no overhead unless verifying an OTA image (in which case it also takes an extra ~300ms to verify the app's signature).

Flash Encryption adds a minimal amount of latency when executable code is read into the internal flash cache (ie whenever the app is running). I don't have exact numbers, and it will depend on the software workload, but it should be quite minor (likely unnoticeable for normal operations).

Writing to encrypted flash is slower than writing to unencrypted flash, probably by a factor of 2-2.5 (again, this depends on the write sizes.)

Angus

User avatar
Vader_Mester
Posts: 300
Joined: Tue Dec 05, 2017 8:28 pm
Location: Hungary
Contact:

Re: Flash encryption effect on ESP32 speed

Postby Vader_Mester » Wed Dec 13, 2017 6:52 am

Off-Topic:
@ESP_Angus - I was hoping for (but didn't expect it, having experience from other community forums), that an aswer would be given by an Espressif member himself! Not only did it happen, but such quickly :o ???
This soooooo rare nowdays, and shows the Espressif's love for a community!
This is awsome! :mrgreen:

Thanks for the quick answer, and keep up the good work! Love the community, and it will love you back :!:
---------------------------------------------------------------

Back to the subject:
I think that if this is not much of a toll, then it shall be fine.
I would not really use the Flash for writing to it.

If I use a SPI-RAM parallel with the Flash (i heared it's possible), then does the Flash encryption affect SPI-RAM writes? It shouldn't but I know how much the handling of the SPI-FLASH and SPI-RAM is related to each other hardware wise, so I'm just curious. I wanna use just a little external RAM using as a circular buffer for my Microphone audio signals :geek:

Code: Select all

task_t coffeeTask()
{
	while(atWork){
		if(!xStreamBufferIsEmpty(mug)){
			coffeeDrink(mug);
		} else {
			xTaskCreate(sBrew, "brew", 9000, &mug, 1, NULL);
			xSemaphoreTake(sCoffeeRdy, portMAX_DELAY);
		}
	}
	vTaskDelete(NULL);
}

ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: Flash encryption effect on ESP32 speed

Postby ESP_Sprite » Thu Dec 14, 2017 8:47 am

Flash encryption should not affect the SPI PSRAM in a major way (maybe a read/write will happen a clock cycle or two later because it'll need for a slightly delayed flash write cycle). Be aware, however, that unlike the flash, SPI PSRAM does not have hardware encryption in the ESP32.

Who is online

Users browsing this forum: No registered users and 111 guests