]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
dtls: Fixup outgoing ClientHello hashing.
authorJonathan Bastien-Filiatrault <joe@x2a.org>
Mon, 3 Aug 2009 19:11:23 +0000 (15:11 -0400)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 17 Feb 2011 21:43:11 +0000 (22:43 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/gnutls_handshake.c

index 4872e50544fd0b55d8b459695954ac67bf993d4c..99a2cdd4f0cdf4f4720ca32e55f62c2b12563bfd 100644 (file)
@@ -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)