Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The function _fp_exptmod_nct() is using WOLFSSL_NO_MALLOC to guard using stack allocation vs malloc. It's twin function _fp_exptmod_ct() is using WOLFSSL_SMALL_STACK for this. This is causing inappropriate use of malloc() in a small stack environment. The no-malloc case will also be kept so static memory and no-malloc fix still works.
#ifndef WOLFSSL_NO_MALLOC
in the function_fp_exptmod_nct()
to#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
.Testing
Verified the code path is correctly set. Ran the wolfcrypttest in the debugger to confirm allocation and no allocation in the function
_fp_exptmod_nct()
. Ran the wolfcrypttest in valgrind.Checklist