From 3e6d77743947e960a835207d43dac8fe7787744e Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 6 Jan 2026 00:46:15 -1000 Subject: [PATCH] fix --- esphome/components/esphome/ota/__init__.py | 2 +- esphome/components/esphome/ota/ota_esphome.cpp | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index f6b6e80d973..2f637d714d1 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -28,7 +28,7 @@ CODEOWNERS = ["@esphome/core"] DEPENDENCIES = ["network"] -AUTO_LOAD = ["md5", "sha256", "socket"] +AUTO_LOAD = ["sha256", "socket"] esphome = cg.esphome_ns.namespace("esphome") diff --git a/esphome/components/esphome/ota/ota_esphome.cpp b/esphome/components/esphome/ota/ota_esphome.cpp index be0dc616074..f71163f79e0 100644 --- a/esphome/components/esphome/ota/ota_esphome.cpp +++ b/esphome/components/esphome/ota/ota_esphome.cpp @@ -1,7 +1,6 @@ #include "ota_esphome.h" #ifdef USE_OTA #ifdef USE_OTA_PASSWORD -#include "esphome/components/md5/md5.h" #include "esphome/components/sha256/sha256.h" #endif #include "esphome/components/network/util.h" @@ -561,11 +560,9 @@ bool ESPHomeOTAComponent::handle_auth_send_() { // CRITICAL ESP32-S3 HARDWARE SHA ACCELERATION: Hash object must stay in same stack frame // (no passing to other functions). All hash operations must happen in this function. - // NOTE: On ESP32-S3 with IDF 5.5.x, having only SHA256 on the stack causes crashes with - // hardware SHA acceleration. Adding an MD5 object provides the necessary stack alignment. - sha256::SHA256 hasher; - md5::MD5Digest md5_dummy; // Required for ESP32-S3 IDF 5.5.x stack alignment - (void) md5_dummy; // Suppress unused variable warning + // NOTE: On ESP32-S3 with IDF 5.5.x, the SHA256 context must be properly aligned for + // hardware SHA acceleration DMA operations. + alignas(32) sha256::SHA256 hasher; const size_t hex_size = hasher.get_size() * 2; const size_t nonce_len = hasher.get_size() / 4; @@ -639,11 +636,9 @@ bool ESPHomeOTAComponent::handle_auth_read_() { // CRITICAL ESP32-S3 HARDWARE SHA ACCELERATION: Hash object must stay in same stack frame // (no passing to other functions). All hash operations must happen in this function. - // NOTE: On ESP32-S3 with IDF 5.5.x, having only SHA256 on the stack causes crashes with - // hardware SHA acceleration. Adding an MD5 object provides the necessary stack alignment. - sha256::SHA256 hasher; - md5::MD5Digest md5_dummy; // Required for ESP32-S3 IDF 5.5.x stack alignment - (void) md5_dummy; // Suppress unused variable warning + // NOTE: On ESP32-S3 with IDF 5.5.x, the SHA256 context must be properly aligned for + // hardware SHA acceleration DMA operations. + alignas(32) sha256::SHA256 hasher; hasher.init(); hasher.add(this->password_.c_str(), this->password_.length());