optee_os with arm64 : Issue related to mempool allocation

Hi All,


I want to generate a rsa key pair with 4096 bits. 
Using below mbedTLS api , inside my TEE server side implementation.

ret = mbedtls_rsa_gen_key( mbedtls_pk_rsa( key ), mbedtls_ctr_drbg_random, &ctr_drbg, 4096, 65537 );

This is resulting in the below error.
mempool_alloc:197Failed to allocate 288 bytes, please tune the pool size failed 

Mines is arm64 infrastructure, with kernel 4.19.183 and optee_os 3.7.0 

We tried doing below change (courtesy: https://github.com/OP-TEE/optee_os/issues/3328) and recompiling tomcrypt library

In core/lib/libtomcrypt/mpi_desc.c, we changed MPI_MEMPOOL_SIZE

      #define MPI_MEMPOOL_SIZE        (42 * 1024)

to    #define MPI_MEMPOOL_SIZE        (82 * 1024)

This didn’t help, kindly provide your inputs.                                                                                      

Thanks