1

I'm working on building a DTLS-Server and Client setup using a different network transport protocol than UDP. But this protocol is as well non-reliable so DTLS is needed. The protocol uses radio networks to transmit data from client to server and vice versa. To make it compatible to DTLS the received data is then forwarded via a UDP-Client to the DTLS-Server on server side and via a UDP-Server to the DTLS-Client on client side both working on localhost.

As a basis I'm using the DTLS example implementations given in the programs/ssl directory of mbedTLS. Due to the fact that the used protocol is not the fastet in case of transmitting I adapted the handshake timeouts by using the mbedtls_ssl_conf_handshake_timeout function so that there aren't any early retransmissions which could interfere the actual data transfer. This is working as needed.

The first handshake message (the ClientHello) is received by the server after about 2 minutes. The server answers with a VerifyRequest and after another 3 minutes the Client's answer (ClientHello+Cookie) is received by the server. But instead of sending a ServerHello the server answers with another VerifyRequest such as he forgot about the first initializing ClientHello.

I compared the received ClientHello messages with some messages produced by a DTLS-Handshake using the same settings but UDP as network protocol and they are nearly equivalent (except for the random parts and the cookies).

Do I need to adapt another timeout timer so that the server waits longer for a second ClientHello? Or is there another thing that I overlooked?

If you need any further descriptions of the problem I'll try to give them.

I'll be grateful for any kind of ideas or hints.

wanssemd
  • 21
  • 3

1 Answers1

2

I apologize for delayed reply
As you can see from the code, the verify request message is sent if the cookie verification failed:

if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
    ssl->handshake->verify_cookie_len != 0 )
{
    MBEDTLS_SSL_DEBUG_MSG( 2, ( "client hello was not authenticated" ) );
    MBEDTLS_SSL_DEBUG_MSG( 2, ( "<= write server hello" ) );

    return( ssl_write_hello_verify_request( ssl ) );
}

You should check your f_cookie_check implementation set in mbedtls_ssl_conf_dtls_cookies(). According to your description, I assume you are using the default cookie check, so you should check for reasons that mbedtls_ssl_cookie_check() Regards,
Mbed TLS Team member
Ron

Ron Eldor
  • 210
  • 1
  • 11