diff --git a/esphome/components/sha256/__init__.py b/esphome/components/sha256/__init__.py index 91d4929a4f..f07157416d 100644 --- a/esphome/components/sha256/__init__.py +++ b/esphome/components/sha256/__init__.py @@ -13,12 +13,10 @@ CONFIG_SCHEMA = cv.Schema({}) async def to_code(config: ConfigType) -> None: # Add OpenSSL library for host platform - if CORE.is_host: - if IS_MACOS: - # macOS needs special handling for Homebrew OpenSSL - cg.add_build_flag("-I/opt/homebrew/opt/openssl/include") - cg.add_build_flag("-L/opt/homebrew/opt/openssl/lib") - cg.add_build_flag("-lcrypto") - else: - # Linux and other Unix systems usually have OpenSSL in standard paths - cg.add_build_flag("-lcrypto") + if not CORE.is_host: + return + if IS_MACOS: + # macOS needs special handling for Homebrew OpenSSL + cg.add_build_flag("-I/opt/homebrew/opt/openssl/include") + cg.add_build_flag("-L/opt/homebrew/opt/openssl/lib") + cg.add_build_flag("-lcrypto")