gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32603 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r32603 - gnunet/src/mesh
Date: Mon, 10 Mar 2014 10:52:47 +0100

Author: bartpolot
Date: 2014-03-10 10:52:46 +0100 (Mon, 10 Mar 2014)
New Revision: 32603

Modified:
   gnunet/src/mesh/gnunet-service-mesh_tunnel.c
Log:
- use 256 hashs for hmac

Modified: gnunet/src/mesh/gnunet-service-mesh_tunnel.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2014-03-10 09:52:45 UTC 
(rev 32602)
+++ gnunet/src/mesh/gnunet-service-mesh_tunnel.c        2014-03-10 09:52:46 UTC 
(rev 32603)
@@ -729,11 +729,12 @@
  */
 static void
 t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv,
-        int outgoing, struct GNUNET_HashCode *hmac)
+        int outgoing, struct GNUNET_MeshHash *hmac)
 {
   struct GNUNET_CRYPTO_AuthKey auth_key;
   static const char ctx[] = "mesh authentication key";
   struct GNUNET_CRYPTO_SymmetricSessionKey *key;
+  struct GNUNET_HashCode hash;
 
   key = outgoing ? &t->e_key : &t->d_key;
   GNUNET_CRYPTO_hmac_derive_key (&auth_key, key,
@@ -741,7 +742,8 @@
                                  key, sizeof (*key),
                                  ctx, sizeof (ctx),
                                  NULL);
-  GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, hmac);
+  GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, &hash);
+  memcpy (hmac, &hash, sizeof (*hmac));
 }
 
 
@@ -1649,11 +1651,11 @@
   char cbuf [payload_size];
   struct GNUNET_MessageHeader *msgh;
   unsigned int off;
-  struct GNUNET_HashCode hmac;
+  struct GNUNET_MeshHash hmac;
 
   decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv);
   t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac);
-  if (0 != memcmp (&hmac, &msg->hmac, sizeof (struct GNUNET_HashCode)))
+  if (0 != memcmp (&hmac, &msg->hmac, sizeof (hmac)))
   {
     /* checksum failed */
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]