Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: crypto: libtomcrypt: fix LTC_CLEAN_STACK bug
LTC_CLEAN_STACK uses burn_stack() API that uses a recursive call which leads to approx. double the size of stack cleaned than expected on ARM64, because it consumes stack space in 32-byte chunks and assumes only buf is pushed onto the stack while ignoring any other data such as lr, fp, etc.. This causes stack overflow corrupting canaries in case we perform a SHA512 hash operation which utilizes maximum stack as compared to other libtomcrypt APIs. So get rid of this recursive call via using variable length array to clean stack. Also, convert zeromem() API as a wrapper to call memzero_explicit(). Fixes: ad56511 ("core: crypto: libtomcrypt: enable LTC_CLEAN_STACK") Suggested-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
- Loading branch information