1

(10 replies, posted in wolfCrypt)

yinzixuansz wrote:

Hi all,

I have been trying to implement RSA on the Raspberry Pi Pico 2W RP2350 microcontroller with the Dual Cortex-M33 processor. However, I am getting stuck at wc_MakeRsaKey

RsaKey priv;
WC_RNG rng;
int ret = 0;
long e = 65537; // standard value to use for exponent

ret = wc_InitRsaKey(&priv, NULL);
printf("wc_InitRsaKey ret: %d\n", ret);
ret = wc_InitRng(&rng);
printf("wc_InitRng ret: %d\n", ret);
ret = wc_RsaSetRNG(&priv, &rng);
printf("wc_RsaSetRNG ret: %d\n", ret);
// generate 2048 bit long private key
ret = wc_MakeRsaKey(&priv, 2048, e, &rng);
printf("wc_MakeRsaKey ret: %d\n", ret);

I have tried the benchmark tests and have been unable to replicate the results at
The platform that WolfSSL tested with is slightly different:
Raspberry Pi Pico-W
ARM Cortext M0+, 125MHz
When trying to run to run bench_main from the example repository in WolfSSL:

The code gets stuck at RSA.


I saw a blog post here related to this issue:


However, I am unsure if this is the issue and, if so, how to resolve it for my Pico 2W. Any help is appreciated.

I’d first check if it’s actually hung or just taking a long time. wc_MakeRsaKey() for a 2048-bit key is a heavy operation on embedded hardware.

Try a smaller key size to confirm it works, and check that wolfCrypt is built with the proper optimizations (SP math, memory settings, etc.). Also verify heap/stack size, because RSA key generation needs a lot of temporary memory. The Pico 2W is faster than the Pico W, but RSA generation can still take a while. Problems of this kind always cause inconvenience; it’s good that this doesn’t happen with https://mostbet.com.kp/.