From b1fd69a2f5d4c1e1779163545e9a19ea19482cd6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 14 Jan 2026 19:40:57 -1000 Subject: [PATCH] limit scope --- esphome/components/sha256/sha256.cpp | 10 +++++----- esphome/components/sha256/sha256.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/sha256/sha256.cpp b/esphome/components/sha256/sha256.cpp index 933e3ff803..23995e6534 100644 --- a/esphome/components/sha256/sha256.cpp +++ b/esphome/components/sha256/sha256.cpp @@ -10,11 +10,11 @@ namespace esphome::sha256 { #if defined(USE_ESP32) || defined(USE_LIBRETINY) -// CRITICAL ESP32-S2/S3 HARDWARE SHA ACCELERATION REQUIREMENTS (IDF 5.5.x): +// CRITICAL ESP32 HARDWARE SHA ACCELERATION REQUIREMENTS (IDF 5.5.x): // -// The ESP32-S2/S3 uses hardware DMA for SHA acceleration. The DMA engine requires proper -// alignment of the digest output buffer. This is handled automatically via HashBase::digest_ -// which has alignas(32). This imposes two critical constraints: +// ESP32 variants (except original ESP32) use DMA-based hardware SHA acceleration that requires +// 32-byte aligned digest buffers. This is handled automatically via HashBase::digest_ which has +// alignas(32) on these platforms. Two additional constraints apply: // // 1. NO VARIABLE LENGTH ARRAYS (VLAs): VLAs corrupt the stack layout, causing the DMA engine to // write to incorrect memory locations. This results in null pointer dereferences and crashes. @@ -35,7 +35,7 @@ namespace esphome::sha256 { // // hasher destroyed when function returns // } // -// INCORRECT USAGE (WILL FAIL ON ESP32-S2/S3): +// INCORRECT USAGE (WILL FAIL): // void my_function() { // sha256::SHA256 hasher; // helper(&hasher); // WRONG: Passed to different stack frame diff --git a/esphome/components/sha256/sha256.h b/esphome/components/sha256/sha256.h index 5fab9bde61..bafb359485 100644 --- a/esphome/components/sha256/sha256.h +++ b/esphome/components/sha256/sha256.h @@ -24,7 +24,7 @@ namespace esphome::sha256 { /// SHA256 hash implementation. /// -/// CRITICAL for ESP32-S2/S3 with IDF 5.5.x hardware SHA acceleration: +/// CRITICAL for ESP32 variants (except original) with IDF 5.5.x hardware SHA acceleration: /// 1. The object MUST stay in the same stack frame (no passing to other functions) /// 2. NO Variable Length Arrays (VLAs) in the same function ///