bas
bas

Reputation: 14982

Mbed TLS with FreeRTOS - MBEDTLS_THREADING_ALT required?

I am trying to integrate MbedTLS (3.6.2 latest stable) in our embedded project which is running on FreeRTOS.

I wonder if I need to enable threading

#define MBEDTLS_THREADING_ALT
#define MBEDTLS_THREADING_C

MbedTLS states

First, most functions use an explicit context. Most of the time, as long as threads do not share this context, you’re safe. However, sometimes threads can share a context indirectly. For example, an SSL context can point to an RSA context (the private key).

Since we have the LWIPs "tcp thread" and we have a another thread which is responsible for reading UART/Ethernet I am pretty sure we will violate this rule, and hence we do need mutexes to guarantee thread safety.

But, when I enable the above defines, I get a compiler error compiling MbedTLS

fatal error: threading_alt.h: No such file or directory
   44 | #include "threading_alt.h"

In this header, I am supposed to define the mutex and semaphore types of the OS (in my case, FreeRTOS). But this would make Mbed TLS depend on FreeRTOS compile time! I don't want that.

Am I missing the obvious here? Anybody out there who can shed a light on this?

Upvotes: 0

Views: 70

Answers (0)

Related Questions