Topic: crash in wc_InitRng_ex() on embedded Arm Cortex M7

I'm trying to run the wolfSSL crypto benchmarks on an NXP S32G3.  The S32G3 has several Arm Cortex M7 cores.

1.  WolfSSL version is 5.7.0
2.  Running on Bare Metal, No OS
3.  Compiler - NXP S32 Design Studio version 3.5 

My code is crashing in the wc_InitRng_ex() function.

I can't use printf() for typical debug information, since my only connection to the device is via a putty terminal interface over UART.  The call to wc_InitRng_ex() fails in such a way that I don't even get any feedback messages.  Yet, I think the failure occurs inside this function because if I comment out this function call then I see debug messages that come after this.

I suspect solving my problem may be related to correctly configuring the device in the user_settings.h file.  I'm just not sure what #defines I need to set or not set.

BTW- everything runs just fine for me when compiling in Visual Studio and running on Windows.  Unfortunately, I really need benchmarks on the M7.

Share

Re: crash in wc_InitRng_ex() on embedded Arm Cortex M7

Hi dcanthony,

How much stack are you giving wolfSSL?  A very common source of crashes/issues is insufficient stack, wolfSSL generally needs about 20-30KB of stack.  As you are on an embedded system I would also recommend defining WOLFSSL_SMALL_STACK.
You may also be running into issues with entropy from your RNG or your RNG in general.  Are you confident your RNG is functioning correctly?

You are correct that you'll usually need additional defines for your RNG, I am not seeing a seed generation function for your platform's RNG so you will need to define your own.

I recommend basing your user_settings.h off of our template here: https://github.com/wolfSSL/wolfssl/blob … template.h
You will want to define your own seed generation function with CUSTOM_RAND_GENERATE: https://github.com/wolfSSL/wolfssl/blob … ate.h#L424

Since you're able to see debug logging, if possible I would recommend upgrading to 5.7.2 and defining WOLFSSL_DEBUG_TRACE_ERROR_CODES in addition to DEBUG_WOLFSSL, this will print error and line numbers in our debug logs.  This feature was added in 5.7.2 so you would need to upgrade for it.

It looks like you have an active support contract with us, can you follow up on this by emailing us at support [AT] wolfssl [DOT] com?  Please provide debug logs and your user_settings.h as well.

Thanks,
Kareem

Share