Topic: WolfSSL and TLS 1.3 Post-Handshake Messages

Hi all,

I have a question regarding WolfSSL when using TLS 1.3.

I noticed that when I receive a Post-Handshake Message, e.g., a New Session Ticket Message, wolfSSL_read() never returns from the function call, but waits until it also gets some APP DATA on the socket.
This can easily be tested when you change the client example slightly and call ClientRead before ClientWrite and connect to a server, which sends the post-handshake message (www.microsoft.de, for example). In this case wolfSSL_read() does not return and 'blocks' until the server closes the connection, because the client does not send any data( because it is blocked).

Of course, in this example it does not make much sense, because the client should send data before it tries to receive data, but according to the RFC https://tools.ietf.org/id/draft-ietf-tls-tls13-25.html:
"At any time after the server has received the client Finished message, it MAY send a NewSessionTicket message"
So in an asynchronous setting I think it could happen that the client receives a post-handshake message in a state where it wants to send some data and this would then block the connection.

Another example I could think of, is when you want to write a proxy with WolfSSL. If you just 'listen' on the sockets and forward any message that is received, it could happen that the server-post-handshake message is received before the client message is forwarded. This would again 'break' the connection. This is actually the scenario where I noticed this problem.


Since I'm no expert in TLS 1.3 and I did not find any 'real' answer when the post-handshake messages are being sent by a server, my question is: Is it intended that wolfSSL_read() blocks  when receiving a post-handshake message and waits until some APP DATA is received? Especially, since the RFC states that the messages may be sent at any time. This means if I would want to write a proxy application I would have to make sure that the messages are processed in the 'correct' order.

Thanks in advance for your time and help!

Cheers!

Share

Re: WolfSSL and TLS 1.3 Post-Handshake Messages

Hi Betontod11,

Thank you so much for reaching out to wolfSSL support. Have you tried using non-blocking sockets?

Warm Regards,

K

Re: WolfSSL and TLS 1.3 Post-Handshake Messages

Hi Kaleb,

at least in the client example I do not get into the state that it breaks the communication. I first receive the post-handshake messages and then I receive the HTTP response.

I will test a little bit more and if I have more questions, I will get back to you.
Thanks for your reply and help!

Cheers!

Share