Mbedtls Thread Safety and Multi Threading: concurrency issues
If you want to use multi threading in mbedtls, You must first open the Macro switch MBEDTS_THREADING_PTHREAD and MBEDTLS_THREADING_C.
Or use other thread-library with MBEDTLS_THREADING_ALT