Topic: CyaSSL and FreeRTOS

Hi all,

I know this is a CyaSSL forum, and not an RTOS forum, but I need to update my CyaSSL embedded SSL project from FreeRTOS v7.x to v8.x.
Is there anyone using CyaSSL together with FreeRTOS v8?


Problem I'm facing is related to CyaSSL_CTX_new()/CyaSSLv23_client_method () functions, failing using heap_4.c file of FreeRTOS v8.
It seems to me that CyaSSL_Malloc was not "tested" using last FreeRTOS memory allocators.

My attempts:
- FreeRTOS v7.2.0 + heap_4.c v7.2.0 -> OK
- FreeRTOS v8.0.1 + heap_4.c v8.0.1 -> KO
- FreeRTOS v8.0.1 + heap_4.c v7.2.0 -> OK again!

Target device is a Cortex M3 micro: STM32F1 serie.


Thanks to all
jerry

Share

Re: CyaSSL and FreeRTOS

Hi Jerry,

Last time we tested CyaSSL against FreeRTOS v8 in house, I believe it was using heap_2.c.  CyaSSL's current FreeRTOS port (when FREERTOS is defined) has relied upon the user having the standard malloc(), free(), and realloc() available.

To be correct, we should probably change our FreeRTOS port to use pvPortMalloc() and pvPortFree() instead.  This is on our list of things to do.

In the meantime, CyaSSL does have a memory abstraction layer which allows users to register their own memory functions for CyaSSL to use.  This could be used to inform CyaSSL of the specific FreeRTOS memory functions you would like it to use.  More details can be found here:

CyaSSL Manual, Section 5.1.1.1: http://www.yassl.com/yaSSL/Docs-cyassl- … ility.html
CyaSSL API Reference, Section 17.10: http://www.yassl.com/yaSSL/Docs-cyassl- … ction.html

Best Regards,
Chris

Re: CyaSSL and FreeRTOS

One more thing to add here is that it looks like although FreeRTOS has pvPortMalloc() and pvPortFree(), it doesn't always have a pvPortRealloc() available.  Because of this, you'll want to use the fastmath math library when compiling CyaSSL (instead of the normal big integer one).  The fastmath library only uses a malloc() and free() function, not a realloc().

Fastmath can be enabled by defining USE_FAST_MATH.  Since stack usage can be higher with the fastmath library, we also recommend defining TFM_TIMING_RESISTANT as well.

Best Regards,
Chris