Mbed TLS is now part of TrustedFirmware.org.

How to use write together read function ?


Apr 13, 2017 11:42
Yigit

Hello ,

I am doing an application with mqtt. How can I use the mbedtls_ssl_write function in another task while reading with mbedtls ssl_read function. For embedded system.

 
Apr 13, 2017 11:54
Yigit

Example using:

Task 1:

while(true)
{
      int len =  mbedtls_ssl_read <--- waiting task data
      if( len > 0)
      {
           Work process
      }
}

Task 2:

while(true)
{
   process 1
   process 2
   mbedtls_ssl_write
   process 3
   mbedtls_ssl_write
   process 4
}

How to run task 1 and task 2 together . I'm having trouble running it right now.

 
Apr 13, 2017 12:13
Ron Eldor

Hi Yigit,
Please follow the following article about how to port to a new platform. Specifically, you will need to implement your own read and write functions, and send them as callback parameter to mbedtls_ssl_set_bio.
The two tasks should share the same mbedtls_ssl_context , so you will need to protect this resource for your ssl handshake.
I hope this gives you a direction
Regards,
mbed TLS Team member
Ron