Porting Timing [for DTLS] to non Unix/Windows platform

I have a project using a 3rd party RTOS [ThreadX] together with the lwIP networking stack. DTLS is required.
I’m working to integrate mbed TLS and then implement the dtls_client app for testing, but need to implement non Windows/Unix timing functionality.
i.e. choosing MBEDTLS_TIMING_C or MBEDTLS_TIMING_ALT config settings, and implementing alternate implementations as necessary.
I’ve read https://tls.mbed.org/kb/how-to/dtls-tutorial but must admit it’s not giving me too many clues about how to port to my platform…
Are there any ‘generic’ reference implementations that will show me how to hook into my hw/rtos?

Hi @ColH
Thank you for your question.
We don’t have generic examples, but we do have additional articles that may assist you:

In addition, I would suggest you look at the API documentation to understand how your alternative implementations should function.
For specific questions, we would be happy to assist.

Mbed TLS team member

@ColH did you make any alternate timing functions for ‘dtls’ on non-unix/windows plateforms? If so, please update us with your finding or at-least give some directions if it is not too much to ask.
Actually, I just started working on peer2peer modelling and i need mbed client [L476RG] to perform dtls handshake with a server.

Hello @ColH @roneld01,
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.
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

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 with you @ColH, if you find it interesting or if you have done something and willing to share or guide, then that would be very much helpful.

Any help in this regards would worth appreciation.