mirror of
https://github.com/esphome/esphome.git
synced 2026-09-16 01:28:39 +00:00
limit scope
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user