From 088543b2222b49208e1ac29b527dd64e143d64db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Mon, 5 Feb 2018 10:44:40 +0100 Subject: [PATCH] Preliminary support for OTA over HTTPS --- code/espurna/config/general.h | 1 + code/espurna/ota.ino | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 715dc2d3..d376a2d4 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -446,6 +446,7 @@ PROGMEM const char* const custom_reset_string[] = { // ----------------------------------------------------------------------------- #define OTA_PORT 8266 // OTA port +#define OTA_GITHUB_FP "D79F076110B39293E349AC89845B0380C19E2F8B" // ----------------------------------------------------------------------------- // NOFUSS diff --git a/code/espurna/ota.ino b/code/espurna/ota.ino index 391da4fd..9164fe69 100644 --- a/code/espurna/ota.ino +++ b/code/espurna/ota.ino @@ -31,7 +31,14 @@ void _otaFrom(const char * url) { #endif ESPhttpUpdate.rebootOnUpdate(false); - t_httpUpdate_return ret = ESPhttpUpdate.update(url); + t_httpUpdate_return ret; + if (strncmp(url, "https", 5) == 0) { + String fp = getSetting("otafp", OTA_GITHUB_FP); + DEBUG_MSG_P(PSTR("[OTA] Using fingerprint: '%s'\n"), fp.c_str()); + ret = ESPhttpUpdate.update(url, APP_VERSION, fp.c_str()); + } else { + ret = ESPhttpUpdate.update(url, APP_VERSION); + } switch(ret) {