diff --git a/esphome/components/sha256/sha256.cpp b/esphome/components/sha256/sha256.cpp index cf3cfb1a30..71e4045499 100644 --- a/esphome/components/sha256/sha256.cpp +++ b/esphome/components/sha256/sha256.cpp @@ -1,4 +1,8 @@ #include "sha256.h" + +// Only compile SHA256 implementation on platforms that support it +#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) + #include "esphome/core/helpers.h" #include @@ -142,3 +146,5 @@ bool SHA256::equals_hex(const char *expected) { } } // namespace esphome::sha256 + +#endif // Platform check diff --git a/esphome/components/sha256/sha256.h b/esphome/components/sha256/sha256.h index 5f56d7542a..2a7aa72183 100644 --- a/esphome/components/sha256/sha256.h +++ b/esphome/components/sha256/sha256.h @@ -1,6 +1,10 @@ #pragma once #include "esphome/core/defines.h" + +// Only define SHA256 on platforms that support it +#if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) + #include #include #include @@ -59,3 +63,5 @@ class SHA256 { }; } // namespace esphome::sha256 + +#endif // Platform check