libmbedtls: mbedtls_mpi_exp_mod(): optimize mempool usage

With W allocated in the mempool instead of the stack it is more important
to utilize the mempool in a stack like way.

With this patch allocation and initialization of W is moved to a point
where all following mempool allocations are free before the function
returns.

This reduces maximum memory consumption of mempool in regression case
8101 for an AArch64 TA in from 17280 to 7640 bytes. Figures for an
AArch32 TA are 12040 to 5288 bytes.

Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
1 file changed
tree: 73c81dbd65cebf949a5be00bc14d406489e93fe1
  1. .github/
  2. core/
  3. keys/
  4. lib/
  5. mk/
  6. scripts/
  7. ta/
  8. .gitignore
  9. .shippable.yml
  10. .travis.yml
  11. CHANGELOG.md
  12. LICENSE
  13. MAINTAINERS
  14. Makefile
  15. README.md
  16. typedefs.checkpatch
README.md

OP-TEE Trusted OS

This git contains source code for the secure side implementation of OP-TEE project.

All official OP-TEE documentation has moved to http://optee.readthedocs.io.

// OP-TEE core maintainers