diff --git a/components/app_update/Kconfig.projbuild b/components/app_update/Kconfig.projbuild index 516ad82a83c..04eeb8ef85b 100644 --- a/components/app_update/Kconfig.projbuild +++ b/components/app_update/Kconfig.projbuild @@ -1,5 +1,6 @@ menu "App Update config" - config SECURE_SIGNED_DATA_PARTITION + + config APP_UPDATE_SECURE_SIGNED_DATA_PARTITION default n bool "Require signed Data partition images" depends on SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT || SECURE_SIGNED_APPS diff --git a/components/app_update/esp_ota_ops.c b/components/app_update/esp_ota_ops.c index 702fe0dd595..f90b71d294b 100644 --- a/components/app_update/esp_ota_ops.c +++ b/components/app_update/esp_ota_ops.c @@ -32,9 +32,9 @@ #include "esp_flash.h" #include "esp_private/esp_flash_internal.h" //For dangerous write protection #include "esp_macros.h" -#if CONFIG_SECURE_SIGNED_DATA_PARTITION +#if CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION #include "psa/crypto.h" -#endif // CONFIG_SECURE_SIGNED_DATA_PARTITION +#endif // CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION #define OTA_SLOT(i) (i & 0x0F) @@ -491,7 +491,7 @@ esp_err_t esp_ota_abort(esp_ota_handle_t handle) return ESP_OK; } -#if CONFIG_SECURE_SIGNED_DATA_PARTITION +#if CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION #define SHA_CHUNK 256 static esp_err_t ota_calc_partition_bin_sha(const esp_partition_t *partition, uint32_t length, uint8_t out_digest[ESP_SECURE_BOOT_DIGEST_LEN], psa_algorithm_t alg) { @@ -573,7 +573,7 @@ static esp_err_t ota_verify_data_partition_signature(const esp_partition_t *part } return err; } -#endif // CONFIG_SECURE_SIGNED_DATA_PARTITION +#endif // CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION static esp_err_t ota_verify_partition(ota_ops_entry_t *ota_ops) { @@ -600,7 +600,7 @@ static esp_err_t ota_verify_partition(ota_ops_entry_t *ota_ops) esp_partition_munmap(partition_table_map); } } -#if CONFIG_SECURE_SIGNED_DATA_PARTITION +#if CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION else if (ota_ops->partition.final->type == ESP_PARTITION_TYPE_DATA && ota_ops->partition.final->subtype == ESP_PARTITION_SUBTYPE_DATA_UNDEFINED) { esp_err_t err = ota_verify_data_partition_signature(ota_ops->partition.staging, ota_ops->wrote_size); @@ -610,7 +610,7 @@ static esp_err_t ota_verify_partition(ota_ops_entry_t *ota_ops) } return ESP_OK; } -#endif // CONFIG_SECURE_SIGNED_DATA_PARTITION +#endif // CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION return ret; } diff --git a/components/app_update/sdkconfig.rename b/components/app_update/sdkconfig.rename new file mode 100644 index 00000000000..267fe3014bd --- /dev/null +++ b/components/app_update/sdkconfig.rename @@ -0,0 +1,4 @@ +# sdkconfig replacement configurations for deprecated options formatted as +# CONFIG_DEPRECATED_OPTION CONFIG_NEW_OPTION + +CONFIG_SECURE_SIGNED_DATA_PARTITION CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION diff --git a/docs/en/api-reference/system/ota.rst b/docs/en/api-reference/system/ota.rst index 5fb5fe4681e..2f1bcddfd9c 100644 --- a/docs/en/api-reference/system/ota.rst +++ b/docs/en/api-reference/system/ota.rst @@ -235,7 +235,7 @@ The verification of signed OTA updates can be performed even without enabling ha Signed Data Partition Updates ------------------------------ -Data partition images can be verified using the same Secure Boot v2 signature mechanism as application images. Enable :menuitem:`CONFIG_SECURE_SIGNED_DATA_PARTITION` to verify data partitions with subtype ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` during OTA updates. +Data partition images can be verified using the same Secure Boot v2 signature mechanism as application images. Enable :menuitem:`CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION` to verify data partitions with subtype ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` during OTA updates. Sign data partition images using: diff --git a/docs/en/security/secure-boot-v2.rst b/docs/en/security/secure-boot-v2.rst index 4c45cc4b627..5d17324f7b4 100644 --- a/docs/en/security/secure-boot-v2.rst +++ b/docs/en/security/secure-boot-v2.rst @@ -420,7 +420,7 @@ An image is verified if the public key stored in any signature block is valid fo Verifying Data Partitions -------------------------- -The Secure Boot v2 signature verification can also verify data partition images during OTA updates. Enable :menuitem:`CONFIG_SECURE_SIGNED_DATA_PARTITION` to verify data partitions with subtype ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED``. +The Secure Boot v2 signature verification can also verify data partition images during OTA updates. Enable :menuitem:`CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION` to verify data partitions with subtype ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED``. Data partition images must be signed using ``idf.py secure-sign-data`` with the same signing key and follow the same format as application images. The verification uses the public key digest(s) stored in eFuse and follows the process described in :ref:`verify_image`. diff --git a/docs/zh_CN/api-reference/system/ota.rst b/docs/zh_CN/api-reference/system/ota.rst index efbbc0fe79a..415d8c586f2 100644 --- a/docs/zh_CN/api-reference/system/ota.rst +++ b/docs/zh_CN/api-reference/system/ota.rst @@ -235,7 +235,7 @@ Kconfig 中的 :menuitem:`CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE` 可以帮助用 签名数据分区的更新 ------------------ -数据分区镜像可以使用与应用镜像相同的 Secure Boot v2 签名机制进行验证。启用 :menuitem:`CONFIG_SECURE_SIGNED_DATA_PARTITION`,以便在 OTA 更新期间验证子类型为 ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` 的数据分区。 +数据分区镜像可以使用与应用镜像相同的 Secure Boot v2 签名机制进行验证。启用 :menuitem:`CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION`,以便在 OTA 更新期间验证子类型为 ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` 的数据分区。 使用以下命令对数据分区镜像进行签名: diff --git a/docs/zh_CN/security/secure-boot-v2.rst b/docs/zh_CN/security/secure-boot-v2.rst index f03097f9ae3..718a4cd3b2e 100644 --- a/docs/zh_CN/security/secure-boot-v2.rst +++ b/docs/zh_CN/security/secure-boot-v2.rst @@ -420,7 +420,7 @@ 验证数据分区 ------------ -Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像。启用 :menuitem:`CONFIG_SECURE_SIGNED_DATA_PARTITION` 以验证子类型为 ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` 的数据分区。 +Secure Boot v2 签名验证也可以在 OTA 更新期间验证数据分区镜像。启用 :menuitem:`CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION` 以验证子类型为 ``ESP_PARTITION_SUBTYPE_DATA_UNDEFINED`` 的数据分区。 数据分区镜像必须使用相同的签名密钥,通过 ``idf.py secure-sign-data`` 进行签名,并采用与应用镜像相同的格式。验证使用存储在 eFuse 中的一个或多个公钥摘要,并遵循 :ref:`verify_image` 中所述的流程。 diff --git a/examples/system/ota/partitions_ota/CMakeLists.txt b/examples/system/ota/partitions_ota/CMakeLists.txt index e56a87b667b..6818e5106d6 100644 --- a/examples/system/ota/partitions_ota/CMakeLists.txt +++ b/examples/system/ota/partitions_ota/CMakeLists.txt @@ -6,7 +6,7 @@ include($ENV{IDF_PATH}/tools/cmake/project.cmake) project(partitions_ota) # Copy storage.bin from test folder to build directory -if(CONFIG_SECURE_SIGNED_DATA_PARTITION) +if(CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION) set(storage_file signed_storage.bin) else() set(storage_file storage.bin) diff --git a/examples/system/ota/partitions_ota/main/app_main.c b/examples/system/ota/partitions_ota/main/app_main.c index 8fde4d06cf0..6b04c473928 100644 --- a/examples/system/ota/partitions_ota/main/app_main.c +++ b/examples/system/ota/partitions_ota/main/app_main.c @@ -209,12 +209,12 @@ static esp_err_t ota_update_partitions(esp_https_ota_config_t *ota_config) } } else if (strstr(ota_config->http_config->url, "storage.bin") != NULL) { -#if CONFIG_SECURE_SIGNED_DATA_PARTITION +#if CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION ota_config->partition.staging = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "staging"); assert(ota_config->partition.staging != NULL); #else ota_config->partition.staging = NULL; // free app ota partition will be selected and used for downloading a new image -#endif // SECURE_SIGNED_DATA_PARTITION +#endif // APP_UPDATE_SECURE_SIGNED_DATA_PARTITION ota_config->partition.final = esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_ANY, "storage"); assert(ota_config->partition.final != NULL); ota_config->partition.finalize_with_copy = true; // After the download is complete, copy the received image to the final partition automatically diff --git a/examples/system/ota/partitions_ota/sdkconfig.ci.flash_enc_wifi_2.data_partition_verification b/examples/system/ota/partitions_ota/sdkconfig.ci.flash_enc_wifi_2.data_partition_verification index a469358b504..1b751c2140f 100644 --- a/examples/system/ota/partitions_ota/sdkconfig.ci.flash_enc_wifi_2.data_partition_verification +++ b/examples/system/ota/partitions_ota/sdkconfig.ci.flash_enc_wifi_2.data_partition_verification @@ -29,4 +29,4 @@ CONFIG_SECURE_SIGNED_ON_UPDATE_NO_SECURE_BOOT=y CONFIG_SECURE_SIGNED_APPS_RSA_SCHEME=y CONFIG_SECURE_BOOT_SIGNING_KEY="test/secure_boot_signing_key.pem" CONFIG_SECURE_BOOT_ALLOW_SHORT_APP_PARTITION=y -CONFIG_SECURE_SIGNED_DATA_PARTITION=y +CONFIG_APP_UPDATE_SECURE_SIGNED_DATA_PARTITION=y