examples: pre_encrypted_ota: update to newer API from esp_encrypted_img component

The members of the esp_decrypt_cfg_t configuration structure have been updated to correctly
reflect that we are using RSA private key member for the decryption purpose. Earlier their names were
incorrect. This old names have been marked as deprecated for IDF 5.2 release. This change can be viewed
at https://github.com/espressif/idf-extra-components/pull/187 and its part of esp_encrypted_img
component version 2.0.4

This commit updated to newer API usage from esp_encrypted_img component v2.0.4 for
pre_encrypted_ota example.
This commit is contained in:
Harshit Malpani
2023-06-06 16:23:33 +05:30
parent 3f58defcc9
commit b9caa324bc

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -109,8 +109,8 @@ void pre_encrypted_ota_task(void *pvParameter)
.keep_alive_enable = true,
};
esp_decrypt_cfg_t cfg = {};
cfg.rsa_pub_key = rsa_private_pem_start;
cfg.rsa_pub_key_len = rsa_private_pem_end - rsa_private_pem_start;
cfg.rsa_priv_key = rsa_private_pem_start;
cfg.rsa_priv_key_len = rsa_private_pem_end - rsa_private_pem_start;
esp_decrypt_handle_t decrypt_handle = esp_encrypted_img_decrypt_start(&cfg);
if (!decrypt_handle) {
ESP_LOGE(TAG, "OTA upgrade failed");