mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-17 23:27:06 +08:00
Merge branch 'feature/https_ota_support_no_verify' into 'master'
esp_https_ota: SSL supports no verification See merge request sdk/ESP8266_RTOS_SDK!1123
This commit is contained in:
@ -9,4 +9,13 @@ config OTA_BUF_SIZE
|
||||
This buffer size depends on CONFIG_HTTP_BUF_SIZE. If you want to enlarge ota buffer size, please also enlarge CONFIG_HTTP_BUF_SIZE.
|
||||
OTA_BUF_SIZE equals to 1460 can save 40% upgrade time in contrast to OTA_BUF_SIZE which equals to 256.
|
||||
|
||||
config OTA_ALLOW_HTTP
|
||||
bool "Allow HTTP for OTA (WARNING: ONLY FOR TESTING PURPOSE, READ HELP)"
|
||||
default n
|
||||
help
|
||||
It is highly recommended to keep HTTPS (along with server certificate validation) enabled.
|
||||
Enabling this option comes with potential risk of:
|
||||
- Non-encrypted communication channel with server
|
||||
- Accepting firmware upgrade image from server with fake identity
|
||||
|
||||
endmenu
|
||||
|
@ -36,10 +36,12 @@ esp_err_t esp_https_ota(const esp_http_client_config_t *config)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
#if !CONFIG_OTA_ALLOW_HTTP
|
||||
if (!config->cert_pem) {
|
||||
ESP_LOGE(TAG, "Server certificate not found in esp_http_client config");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_http_client_handle_t client = esp_http_client_init(config);
|
||||
if (client == NULL) {
|
||||
@ -47,10 +49,12 @@ esp_err_t esp_https_ota(const esp_http_client_config_t *config)
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
#if !CONFIG_OTA_ALLOW_HTTP
|
||||
if (esp_http_client_get_transport_type(client) != HTTP_TRANSPORT_OVER_SSL) {
|
||||
ESP_LOGE(TAG, "Transport is not over HTTPS");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_err_t err = esp_http_client_open(client, 0);
|
||||
if (err != ESP_OK) {
|
||||
|
Reference in New Issue
Block a user