Topic: RSA InitRsaKey Memory Error

What would be causing a MEMORY_E error during the initialization of an RSA key?

My user_settings.h defines related to RSA are:

WC_RSA_BLINDING
WC_RSA_PSS
USE_WOLFSSL_MEMORY
WOLFSSL_HAVE_SP_RSA
WOLFSSL_KEY_GEN
TARGET_EMBEDDED

If it helps I have also tried NO_MALLOC which causes the RSA initialization to hang indefinitely.

This on a Linux machine.

Share

Re: RSA InitRsaKey Memory Error

Hi Bryce,

If you are using fast math, then you need to define FP_MAX_BITS to double the largest key size you intend to use.

So for using RSA 1024 bit keys, define FP_MAX_BITS to 2048

Let us know if that helps.

Thanks,
Eric - wolfSSL Support

3 (edited by bryce.bartlett 2025-05-29 16:02:13)

Re: RSA InitRsaKey Memory Error

I'm currently not using fast math in my user_settings.h. I've also found that defining WOLFSSL_STATIC_MEMORY causes wc_InitRsaKey to hang indefinitely.

Line 4862 in rsa.c seems to be the check that is causing things to fail.

Share

Re: RSA InitRsaKey Memory Error

Hi Bryce,

Please send an email to support@wolfssl.com

This forum is not our preferred communication channel for customers.

Thanks,
Eric