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

Add support for encrypted UF2 images (AEGHB-783) #398

Open
3 tasks done
gudvinr opened this issue Aug 19, 2024 · 0 comments
Open
3 tasks done

Add support for encrypted UF2 images (AEGHB-783) #398

gudvinr opened this issue Aug 19, 2024 · 0 comments

Comments

@gudvinr
Copy link

gudvinr commented Aug 19, 2024

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

When you enable secure boot and flash encryption, there's currently no simple option to update device through USB without making flash encryption useless.

Currently, you can use esp_encrypted_img to update ESP using encrypted firmware image via OTA.
There is an existing integration to HTTPS OTA but there's no implementation to update when using USB.

You can also use tinyuf2 to update firmware through USB MSC.
But UF2 doesn't have built-in encryption.

You can use esp_encrypted_img component and flash images via USB by placing them onto exposed USB MSC device, but it'd be basically re-implementation of tinyuf2 with different image format.

However, UF2 supports extension tags:

When the 0x8000 flag is set, additional information can be appended right after payload data (i.e., it starts at 32 + payloadSize).

So, it is quite possible to add this part of custom encrypted image as an extension:
image
In that case, you essentially get "ESP Encrypted Image" but in UF2 format.

Another option is to use same read-protected key that is used for flash encryption, as described in the docs.
This way you don't need to store an additional RSA key nor add any headers. But it is likely less convenient to use since you need to store a bunch of security-sensitive AES keys instead of just public RSA key(s).

It doesn't matter if this extension tag is "non-standard". Encryption scheme for different devices will not be the same anyway. And you won't feed same UF2 binary to different platform either.

@github-actions github-actions bot changed the title Add support for encrypted UF2 images Add support for encrypted UF2 images (AEGHB-783) Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants