I have generated ECC521 key pair and keep it as mbedtls_pk_context blob.
It seems to me It consume > 5K of memory from mbedtls heap.
( No idea yet why )
Are mbedtls has some API for serialize mbedtls_pk_context to plain array and recover back ?
I would like to store pair as file and recover back when need.
Or how this kind of issues are handled usually ?
Serialization and recover can be used for compact mbedtls heap as well. Blob occupy ~80 blocks and may be they not so contiguous. If I have few key pairs they fragment heap a lot and I need more heap for execute other operations. As result more and more heap reservation for predict worst case scenario.