ARMmbed / mbed-crypto

The development of Mbed Crypto has moved to Mbed TLS. No updates will be made to the mbed-crypto repository anymore.
Apache License 2.0
103 stars 100 forks source link

Reducing stack memory consumption #355

Open pouyaashraf opened 4 years ago

pouyaashraf commented 4 years ago

Description

When using the mbedtls library on certain embedded platforms, a stack-allocated buffer (buf in mbedtls_rsa_rsassa_pss_verify_ext) provokes a stack overflow. The platform in question is LittleKernel running on ARM, where we unfortunately don't have the option of increasing the stack alotted to the kernel. Changing the buf variable to have static storage duration resolves this, but then the function becomes thread un-safe which is not desirable.

Issue request type

[ ] Question
[x] Enhancement
[ ] Bug
pouyaashraf commented 4 years ago

To add to this, the amount of memory allocated by buf is 1KiB, and it's done here: https://github.com/ARMmbed/mbed-crypto/blob/development/library/rsa.c#L2165

ciarmcom commented 4 years ago

Internal Jira reference: https://jira.arm.com/browse/IOTCRYPT-1042