mirror of
https://github.com/esphome/esphome.git
synced 2025-09-22 13:12:22 +01:00
preen
This commit is contained in:
@@ -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:
|
||||||
|
@@ -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;
|
||||||
|
Reference in New Issue
Block a user