espressif / idf-extra-components

Additional components for ESP-IDF, maintained by Espressif
136 stars 85 forks source link

fix(esp_encrypted_img): correct the dependency for generating encrypted image #350

Closed mahavirj closed 5 days ago

mahavirj commented 1 week ago

Closes https://github.com/espressif/idf-extra-components/issues/349

Checklist

Change description

Please describe your change here

bonnee commented 1 week ago

While you're there, it would be more versatile to have the function create a dynamic target name (e.g. based on input/output file name). This will enable the possibility to call the function on multiple files (in my use case I need to encrypt multiple partitions)

mahavirj commented 1 week ago

@bonnee

I didn't quite get your requirement, can you please share more information, any pointers to your use-case? Interim, the existing target is used from ESP-IDF example as well, so we can keep that same and maybe consider making provision for new one.

bonnee commented 1 week ago

Okay, so I have a project that makes use of a spiffs partition. I want to encrypt both the firmware partition and the spiffs in order to securely flash them on my esp32. With the current function I cannot do that as there would be a duplicate target name. I recreated the function by changing add_custom_target(encrypt_bin_target, ... with

get_filename_component(name ${tar_file} NAME)
set(target_name archive_${name}_target)
add_custom_target(${target_name}, ...

This will create (almost) unique targets for each call and solve my use case.

mahavirj commented 1 week ago

@bonnee

I want to encrypt both the firmware partition and the spiffs in order to securely flash them on my esp32.

Just to clarify the pre encrypted OTA scheme only ensures confidentiality over network transport and as such its not related to flash encryption. Please refer this guide: https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/system/esp_https_ota.html#ota-upgrades-with-pre-encrypted-firmware.

github-actions[bot] commented 1 week ago

Unit Test Results

  15 files  ±0    15 suites  ±0   21m 9s :stopwatch: +12s   27 tests ±0    27 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0  382 runs  ±0  382 :heavy_check_mark: ±0  0 :zzz: ±0  0 :x: ±0 

Results for commit 3951f12c. ± Comparison against base commit 27742db3.

:recycle: This comment has been updated with latest results.

bonnee commented 1 week ago

Yes I am aware of that. I want to encrypt images in order to send them securely over unsecure channels

hmalpani commented 1 week ago

@bonnee The script esp_enc_img_gen.py present in tools/ can be used to create the encrypted image for the spiffs partition.