1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-22 13:12:22 +01:00
This commit is contained in:
J. Nick Koston
2025-09-18 15:06:51 -05:00
parent 853d3ae331
commit f15c83462c
2 changed files with 4 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ DEPENDENCIES = ["network"]
def AUTO_LOAD(): def AUTO_LOAD():
"""Conditionally auto-load sha256 only on platforms that support it.""" """Conditionally auto-load sha256 only on platforms that support it."""
base_components = ["md5", "socket"] base_components = ["md5", "socket"]
if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040: if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny:
return base_components + ["sha256"] return base_components + ["sha256"]
return base_components return base_components
@@ -136,8 +136,7 @@ async def to_code(config):
cg.add(var.set_port(config[CONF_PORT])) cg.add(var.set_port(config[CONF_PORT]))
# Only include SHA256 support on platforms that have it # Only include SHA256 support on platforms that have it
# This prevents including unnecessary SHA256 code on platforms like LibreTiny if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040 or CORE.is_libretiny:
if CORE.is_esp32 or CORE.is_esp8266 or CORE.is_rp2040:
cg.add_define("USE_OTA_SHA256") cg.add_define("USE_OTA_SHA256")
if CONF_PASSWORD in config: if CONF_PASSWORD in config:

View File

@@ -4,7 +4,7 @@
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "mbedtls/sha256.h" #include "mbedtls/sha256.h"
#elif defined(USE_ESP8266) || defined(USE_RP2040) #elif defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
#include <SHA256.h> #include <SHA256.h>
#endif #endif
@@ -45,7 +45,7 @@ void SHA256::calculate() {
mbedtls_sha256_finish(&this->ctx_->ctx, this->ctx_->hash); mbedtls_sha256_finish(&this->ctx_->ctx, this->ctx_->hash);
} }
#elif defined(USE_ESP8266) || defined(USE_RP2040) #elif defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY)
struct SHA256::SHA256Context { struct SHA256::SHA256Context {
::SHA256 sha; ::SHA256 sha;