[gnutls-help] Interrupt and continue handshake from gnutls_handshake_set_post_client_hello_function()

DEXTER mydexterid at gmail.com
Wed May 21 11:12:39 CEST 2014


I'm trying to write a gnutls server where I can suspend the handshake
procedure and then continue.
What I'm trying to achieve is to get the SNI from the client, suspend the
handshake, do something else depending on the SNI, then come back to the
handshake and continue.

So I connected a callback with
gnutls_handshake_set_post_client_hello_function() and got the servername in
the callback then return with GNUTLS_E_AGAIN. This will cause the
gnutls_handshake(session) function to return with GNUTLS_E_AGAIN, so I can
continue doing some other things. Also I save the data from the client into
a temp buffer. Then some time later I call the gnutl_handshake(session)
again, which causes the the pull_function to be called.(I have pull/push
functions to read/write from sockets) In this function I simply give the
data from the temp buffer (and when the buffer is empty, I continue reading
from the client socket). The handshake continues, but at the end I receive:
"An error was encountered at the TLS Finished packet calculation."

Also.. if I simply deinit, then init the session again before continuing
the handshake with the client, then I don't get the abovementioned error.

The question is that is this the way one should do to continue a suspended
handshake, or is there another way to do it?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20140521/d47d0ae3/attachment.html>

More information about the Gnutls-help mailing list