Mbed TLS is now part of TrustedFirmware.org.

Threading mutex leak when freeing DTLS Cookie


Jan 23, 2017 13:24
Alan Gillingham

I have defined MBEDTLS_THREADING_C. In ssl_cookie.c we have:

void mbedtls_ssl_cookie_free( mbedtls_ssl_cookie_ctx *ctx )
{
    mbedtls_md_free( &ctx->hmac_ctx );

#if defined(MBEDTLS_THREADING_C)
    mbedtls_mutex_init( &ctx->mutex );
#endif

    mbedtls_zeroize( ctx, sizeof( mbedtls_ssl_cookie_ctx ) );
}

i think mbedtls_mutex_init(&ctx->mutex) should be mbdedtls_mutex_free(&ctx_mutex)?

Alan.

 
Jan 25, 2017 09:59
Ron Eldor

Hi Alan,
Thank you for reporting this issue. You are correct, the mutex should be freed in this location. I have opened a github issue to track this issue.
Regards,
mbed TLS team member
Ron