In our project we use mbedTLS together with freeRTOS. mbedTLS requires an mbedtls_ssl_context (let’s say
ssl_context) for the send (
mbedtls_ssl_write(...)) and receive (
mbedtls_ssl_read(...)) functions. In our project we have a freeRTOS task
A to send data with mbedTLS and a freeRTOS task
Bto receive data with mbedTLS over the same session/interface. Both tasks use the same
ssl_context instance. Potentially sending and receiving can happen at the same time.
Is it safe to use the same
ssl_context instance from both taks? Or should only one task access the
At the moment we are using
mbedtls_ssl_read(...) in blocking mode and hence the
ssl_context cannot be protected against multiple access with a mutexm because then the sending task cannot obtain the mutex as long as the receiving task is the blocked receiving state (holding the mutext).