This commit is contained in:
J. Nick Koston
2026-01-06 00:46:15 -10:00
parent f5ae09056c
commit 3e6d777439
2 changed files with 7 additions and 12 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ CODEOWNERS = ["@esphome/core"]
DEPENDENCIES = ["network"]
AUTO_LOAD = ["md5", "sha256", "socket"]
AUTO_LOAD = ["sha256", "socket"]
esphome = cg.esphome_ns.namespace("esphome")
+6 -11
View File
@@ -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());