-
Notifications
You must be signed in to change notification settings - Fork 91
Feature request: Pre-encrypted OTA support from ESP-IDF. #153
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
Comments
hi, since this is a library for Arduino C++ layer, and using C functions from esp-idf would create a versions nightmare along with a never ending tech debt, direct use of esp-idf internals is reduced to its strict minimum. luckily arduino-esp32 core 3.x.x is bundled with support for AES OTA updates, so it's just a matter of calling
|
Good idea! Sadly, it is not part of the platformio version of esp-idf. I am using arduino framework as a component. I am trying to import it to my project, however it is refusing to compile with bunch of idf version mismatch errors... |
platformio espressif support is (in a business sense) at a halt, but there's an ongoing community effort to support more recent versions of esp-idf and arduino framework: https://github.com/pioarduino/platform-espressif32 it is based on idf version 5.1.4 + arduino core 3.0.3 so you'll have to match these in your project, and obviously use a modified platformio.ini |
Thanks @tobozo . We tried to compile our code with pioarduino, however there is a bug that is needed to be fixed which causing build error when converting elf file to bin due to long file path names. So, until they figure out how to fix that, it is also not viable solution. I dont understand why espressif stopped supporting platformio. Stupid decision IMO. |
So I am able to run our code with pioarduino and trying to implement Update.setupCrypt(), however I am lost about implementation part since I am using ESP32-S3 and not sure how to set it up to work with the ESP32FOTA. It stuck during firmware download progress if I try to download encrypted firmware bin file. I do also opened an ticket regarding with issue in esp32-arduino repository.(espressif/arduino-esp32#10155) Any suggestions will be helpful!
|
looks like setupCrypt() is ignored, if possible, can you show the source of the main sketch? I've double checked the espressif example, although they seem to call Update.setupCrypt() after Update.begin(), the values set by setupCrypt() shouldn't be reset. I can't test anything before next monday but if you're ready to play with esp32fota.cpp, this is the line where Update.setupCrypt() should be inserted to match with espressif example: // BEGIN INSERT
if (!Update.setupCrypt(OTA_KEY, OTA_ADDRESS, OTA_CFG, OTA_MODE)) {
Serial.println("Update.setupCrypt failed!");
return false;
}
// END INSERT
// Some activity may appear in the Serial monitor during the update (depends on Update.onProgress)
size_t written = F_writeStream(); please let me know if this gives results and I'll think about a way to integrate that in esp32fota more elegantly |
@tobozo Thanks for reopening the issue. I managed to get it working just a moment ago. Only thing you need to be careful is it is required to encrypt the plain firmware binaries using the OTA key generated for Update.setupCrypt, not with the flash encryption keys that is burned to efuse of the ESP32. I used the following command to encrypt the binaries for OTA.
Basically you need to create 2 different encryption keys.
If understand it correctly, it works like this: When OTA update begins, the file downloaded will be decrypted using OTA key and then encrypted again with efuse key into ESP32 flash memory in realtime as it is downloaded from the server. So when ESP32 reboots, the firmware is already encrypted, so, no need to wait for encryption again, nice feature! I suggest to test it further and create a separate example demo for the next release of this plugin, since a lot of people is asking for this feature for ages, or maybe including this feature into ESP32FOTA itself by calling it from config section.
|
BTW I modified the ESP32FOTA library in my favor to handle HTTP response codes better for my application. So you can ignore the following section in my code.
|
|
Hi there.
Is there any possibility to implement this feature as it is already being a part of esp32?
https://github.com/espressif/esp-idf/tree/master/examples/system/ota/pre_encrypted_ota
That will be great addition to this library!
The text was updated successfully, but these errors were encountered: