From: Jonathan Bastien-Filiatrault Date: Mon, 3 Aug 2009 19:11:23 +0000 (-0400) Subject: dtls: Fixup outgoing ClientHello hashing. X-Git-Tag: gnutls_2_99_0~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=222f1277bc052ff97dd7b65b431c2c016bd0dfe1;p=thirdparty%2Fgnutls.git dtls: Fixup outgoing ClientHello hashing. Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 4872e50544..99a2cdd4f0 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -1214,6 +1214,22 @@ _gnutls_send_handshake (gnutls_session_t session, mbuffer_st * bufel, (long) datasize); + /* If we send a second or more ClientHello due to a + HelloVerifyRequest, we only remember the last ClientHello + sent for hashing purposes. */ + if (_gnutls_is_dtls(session) + && type == GNUTLS_HANDSHAKE_CLIENT_HELLO + && (session->internals.last_handshake_out == GNUTLS_HANDSHAKE_CLIENT_HELLO + || session->internals.last_handshake_out == -1)) + { + _gnutls_handshake_hash_buffers_clear (session); + if ((ret = _gnutls_handshake_hash_init (session)) < 0) + { + gnutls_assert (); + return ret; + } + } + /* Here we keep the handshake messages in order to hash them... */ if (type != GNUTLS_HANDSHAKE_HELLO_REQUEST)