A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/espressif/esp-idf/commit/bd3cd0cc0ca9ed7199a1b21bef44cc6456c7e4b6 below:

Merge branch 'bugfix/preencrypted_ota_failed_with_partial_download_v5… · espressif/esp-idf@bd3cd0c · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+21

-2

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+21

-2

lines changed Original file line number Diff line number Diff line change

@@ -62,6 +62,7 @@ typedef struct {

62 62

#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB

63 63

decrypt_cb_t decrypt_cb; /*!< Callback for external decryption layer */

64 64

void *decrypt_user_ctx; /*!< User context for external decryption layer */

65 +

uint16_t enc_img_header_size; /*!< Header size of pre-encrypted ota image header */

65 66

#endif

66 67

} esp_https_ota_config_t;

67 68 Original file line number Diff line number Diff line change

@@ -48,6 +48,7 @@ struct esp_https_ota_handle {

48 48

#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB

49 49

decrypt_cb_t decrypt_cb;

50 50

void *decrypt_user_ctx;

51 +

uint16_t enc_img_header_size;

51 52

#endif

52 53

};

53 54

@@ -306,6 +307,11 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http

306 307

}

307 308 308 309

https_ota_handle->image_length = esp_http_client_get_content_length(https_ota_handle->http_client);

310 +

#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB

311 +

/* In case of pre ecnrypted OTA, actual image size of OTA binary includes header size

312 +

which stored in variable enc_img_header_size*/

313 +

https_ota_handle->image_length -= ota_config->enc_img_header_size;

314 +

#endif

309 315

esp_http_client_close(https_ota_handle->http_client);

310 316 311 317

if (https_ota_handle->image_length > https_ota_handle->max_http_request_size) {

@@ -332,6 +338,11 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http

332 338 333 339

if (!https_ota_handle->partial_http_download) {

334 340

https_ota_handle->image_length = esp_http_client_get_content_length(https_ota_handle->http_client);

341 +

#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB

342 +

/* In case of pre ecnrypted OTA, actual image size of OTA binary includes header size

343 +

which stored in variable enc_img_header_size*/

344 +

https_ota_handle->image_length -= ota_config->enc_img_header_size;

345 +

#endif

335 346

}

336 347 337 348

https_ota_handle->update_partition = NULL;

@@ -359,6 +370,7 @@ esp_err_t esp_https_ota_begin(const esp_https_ota_config_t *ota_config, esp_http

359 370

}

360 371

https_ota_handle->decrypt_cb = ota_config->decrypt_cb;

361 372

https_ota_handle->decrypt_user_ctx = ota_config->decrypt_user_ctx;

373 +

https_ota_handle->enc_img_header_size = ota_config->enc_img_header_size;

362 374

#endif

363 375

https_ota_handle->ota_upgrade_buf_size = alloc_size;

364 376

https_ota_handle->bulk_flash_erase = ota_config->bulk_flash_erase;

@@ -567,10 +579,14 @@ esp_err_t esp_https_ota_perform(esp_https_ota_handle_t https_ota_handle)

567 579

if (handle->state == ESP_HTTPS_OTA_IN_PROGRESS && handle->image_length > handle->binary_file_len) {

568 580

esp_http_client_close(handle->http_client);

569 581

char *header_val = NULL;

582 +

int header_size = 0;

583 +

#if CONFIG_ESP_HTTPS_OTA_DECRYPT_CB

584 +

header_size = handle->enc_img_header_size;

585 +

#endif

570 586

if ((handle->image_length - handle->binary_file_len) > handle->max_http_request_size) {

571 -

asprintf(&header_val, "bytes=%d-%d", handle->binary_file_len, (handle->binary_file_len + handle->max_http_request_size - 1));

587 +

asprintf(&header_val, "bytes=%d-%d", handle->binary_file_len + header_size, (handle->binary_file_len + header_size + handle->max_http_request_size - 1));

572 588

} else {

573 -

asprintf(&header_val, "bytes=%d-", handle->binary_file_len);

589 +

asprintf(&header_val, "bytes=%d-", handle->binary_file_len + header_size);

574 590

}

575 591

if (header_val == NULL) {

576 592

ESP_LOGE(TAG, "Failed to allocate memory for HTTP header");

Original file line number Diff line number Diff line change

@@ -74,6 +74,7 @@ static esp_err_t _decrypt_cb(decrypt_cb_arg_t *args, void *user_ctx)

74 74

if (err != ESP_OK && err != ESP_ERR_NOT_FINISHED) {

75 75

return err;

76 76

}

77 + 77 78

static bool is_image_verified = false;

78 79

if (pargs.data_out_len > 0) {

79 80

args->data_out = pargs.data_out;

@@ -143,6 +144,7 @@ void pre_encrypted_ota_task(void *pvParameter)

143 144

#endif

144 145

.decrypt_cb = _decrypt_cb,

145 146

.decrypt_user_ctx = (void *)decrypt_handle,

147 +

.enc_img_header_size = esp_encrypted_img_get_header_size(),

146 148

};

147 149 148 150

esp_https_ota_handle_t https_ota_handle = NULL;

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4