1 year, 5 months ago.

How to implement custom mbedtls timing callback functions for dtls?

AoA, Is there anybody, who started or have made any customized mbedtls timing callback functions to support dtls handshake? Is so, then please update with your findings or at-least give some directions if it is not too much to ask.

I just started building a dtls server/client application on mbed-RTOS using L476RG but found it difficult to properly perform handshake [stable] due to undefined timing callback functions.

client makes a reserved 'client hello' packet using dtls session but couldn't perform next handshake stages properly. Any help in this regards would be worth appreciation.


1 Answer

Bilal Butt
1 year, 5 months ago.

Hello, I have been working on peer2peer modelling for almost 6 months and i have developed both {tcp/tls, udp/dtls} models with {PSK/Certificates} on windows platform using mbed-tls. Now i am interested in modelling them on mbed-platform {Nucleo-L476RG}, I have developed tcp/tls model on it but got a bit stuck while developing udp/dtls model on mbed-platform due to the lack of timing callbacks to support handshaking process. I got into a bit digging this issue by myself and i found out that there literally is no other way to perform dtls-handshake on mbed-rtos for non-unix/windows platform but to add the timing callbacks so that both the peers should process the handshake in a locked manner {as shall prescribed by the callbacks}

The forums/pages/tutorials/API-documentations made it a bit easy to at-least make the underlying setup ready. The formal process i followed is;

-> From this tutorial: https://tls.mbed.org/kb/how-to/dtls-tutorial

/media/uploads/ImranBilalButt/1.png /media/uploads/ImranBilalButt/2.png

it said to enable dtls_set_timing_cb() function in client/server application plus add the reference to "set_delay and get_delay" functions.

-> For that i went in to mbedtls config file "config.h" and scrolled down a bit and found out MBEDTLS_TIMING_ALT flag which says in its detail to enable it to link your self made timing_alt.h file reference during compilation process.


For that i made a custom file timing_alt.h and declared almost all the initial functions to at-least process the linkage/compilation.


"timing_alt.h" drive shareable link {find in below}


After doing all of this, i am just able to successfully build/compile and add the callbacks {without defining} into the udp/dtls session on "nonunix/windows" platform but the main issue is still there {open} to add implementation for those timing functions.

I would very much like to collaborate for this consent and if anyone has done something and willing to share or guide, then that would be very much helpful.

Any help in this regards would worth appreciation.


Assigned to Bilal Butt 1 year, 5 months ago.

This means that the question has been accepted and is being worked on.