diff --git a/esphome/components/api/crypto_optimize.py.script b/esphome/components/api/crypto_optimize.py.script index fe693d1911..1093a09bf6 100644 --- a/esphome/components/api/crypto_optimize.py.script +++ b/esphome/components/api/crypto_optimize.py.script @@ -1,9 +1,9 @@ -# Compile crypto libraries with -O2 for speed instead of the default -Os. -# Crypto is CPU-bound and benefits significantly from speed optimization. -# GCC uses the last -O flag, so appending -O2 overrides the global -Os -# for these libraries only. +# Compile libsodium with -O2 for speed instead of the default -Os. +# libsodium provides the crypto primitives (Curve25519, ChaCha20, Poly1305) +# used by the Noise protocol and benefits significantly from speed optimization. +# GCC uses the last -O flag, so appending -O2 overrides the global -Os. Import("env") for lb in env.GetLibBuilders(): - if lb.name in ("noise-c", "libsodium"): + if lb.name == "libsodium": lb.env.Append(CCFLAGS=["-O2"])