Memory optimization : ECDSA key pair generation

Hello,

My requirement is to generate asymmetric keys for default password using mbedtls on LPC1125 controller with limited footprint.

I have used ECDSA to generate public and private key for default password. keys are generated successfully.

Code is as below,
uint8_t CYBER_GenerateKeys(union CryptoStorage *pKeyWallet, uint8_t *PassCode, uint8_t Length)
{
int ret;
mbedtls_ecdsa_context ctx_sign;
mbedtls_entropy_context entropy;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_ecdsa_init( &ctx_sign );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_entropy_init( &entropy );

if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
                           (const unsigned char *) PassCode,
                           Length ) ) != 0 )
{
  return ret;
}

if( ( ret = mbedtls_ecdsa_genkey( &ctx_sign, MBEDTLS_ECP_DP_SECP256R1,
mbedtls_ctr_drbg_random, &ctr_drbg ) ) != 0 )
{
return ret;
}

return ret;

}

Approximately memory utilized is as below:
Flash : 28KB
RAM : 25KB

I want to generate keys on a controller with limited memory memory, only 35KB flash and 5KB RAM is available. Is there any way of optimization that can help to reduce RAM and ROM footprint of mbedtls library?

Thanks a lot!