Home
last modified time | relevance | path

Searched hist:"03121 b2ca443384ef046706498a11dbfb9dc931c" (Results 1 – 2 of 2) sorted by relevance

/optee_os/core/lib/libtomcrypt/src/misc/
H A Dburn_stack.c03121b2ca443384ef046706498a11dbfb9dc931c Thu Jun 27 13:49:59 UTC 2019 Sumit Garg <sumit.garg@linaro.org> 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: ad565116a0d7 ("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>
H A Dzeromem.c03121b2ca443384ef046706498a11dbfb9dc931c Thu Jun 27 13:49:59 UTC 2019 Sumit Garg <sumit.garg@linaro.org> 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: ad565116a0d7 ("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>