limit scope

This commit is contained in:
J. Nick Koston
2026-01-14 19:40:57 -10:00
parent 9296fc8d4a
commit b1fd69a2f5
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -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
+1 -1
View File
@@ -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
///