mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-09-02 12:03:44 +00:00
mbedtls_ct_memcmp is declared in the tf-psa-crypto header but its implementation isn't compiled into the current Zephyr mbedtls build (would require enabling additional TLS features). Use a local ct_memeq() with `volatile uint8_t` accumulator instead — pattern matches rweather/arduinolibs Crypto.cpp secure_compare(). Disassembly verified on rak3401_1watt (Thumb-2): loop branches on the iterator pointer not the accumulator, result is load-modify- stored to stack every iteration (volatile preserved), final return uses clz+shift instead of a conditional branch on the value. Spotted by nextgens during review of meshcore-dev/MeshCore#2556 mitigations.