diff options
author | Bart Polot <bart@net.in.tum.de> | 2014-03-10 09:52:46 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2014-03-10 09:52:46 +0000 |
commit | aed2e25ac1b9e0ff39b3408ddb9df29bb152fa49 (patch) | |
tree | 570634916b613868b816104ca5c3cb75a6af3bfc /src/mesh/gnunet-service-mesh_tunnel.c | |
parent | 89e4dd984b75138960cf43544f9637c2eef5981c (diff) | |
download | gnunet-aed2e25ac1b9e0ff39b3408ddb9df29bb152fa49.tar.gz gnunet-aed2e25ac1b9e0ff39b3408ddb9df29bb152fa49.zip |
- use 256 hashs for hmac
Diffstat (limited to 'src/mesh/gnunet-service-mesh_tunnel.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh_tunnel.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 4d6bccb70..f475e2d0c 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c | |||
@@ -729,11 +729,12 @@ queue_data (struct MeshTunnel3 *t, const struct GNUNET_MessageHeader *msg) | |||
729 | */ | 729 | */ |
730 | static void | 730 | static void |
731 | t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, | 731 | t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, |
732 | int outgoing, struct GNUNET_HashCode *hmac) | 732 | int outgoing, struct GNUNET_MeshHash *hmac) |
733 | { | 733 | { |
734 | struct GNUNET_CRYPTO_AuthKey auth_key; | 734 | struct GNUNET_CRYPTO_AuthKey auth_key; |
735 | static const char ctx[] = "mesh authentication key"; | 735 | static const char ctx[] = "mesh authentication key"; |
736 | struct GNUNET_CRYPTO_SymmetricSessionKey *key; | 736 | struct GNUNET_CRYPTO_SymmetricSessionKey *key; |
737 | struct GNUNET_HashCode hash; | ||
737 | 738 | ||
738 | key = outgoing ? &t->e_key : &t->d_key; | 739 | key = outgoing ? &t->e_key : &t->d_key; |
739 | GNUNET_CRYPTO_hmac_derive_key (&auth_key, key, | 740 | GNUNET_CRYPTO_hmac_derive_key (&auth_key, key, |
@@ -741,7 +742,8 @@ t_hmac (struct MeshTunnel3 *t, const void *plaintext, size_t size, uint32_t iv, | |||
741 | key, sizeof (*key), | 742 | key, sizeof (*key), |
742 | ctx, sizeof (ctx), | 743 | ctx, sizeof (ctx), |
743 | NULL); | 744 | NULL); |
744 | GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, hmac); | 745 | GNUNET_CRYPTO_hmac (&auth_key, plaintext, size, &hash); |
746 | memcpy (hmac, &hash, sizeof (*hmac)); | ||
745 | } | 747 | } |
746 | 748 | ||
747 | 749 | ||
@@ -1649,11 +1651,11 @@ GMT_handle_encrypted (struct MeshTunnel3 *t, | |||
1649 | char cbuf [payload_size]; | 1651 | char cbuf [payload_size]; |
1650 | struct GNUNET_MessageHeader *msgh; | 1652 | struct GNUNET_MessageHeader *msgh; |
1651 | unsigned int off; | 1653 | unsigned int off; |
1652 | struct GNUNET_HashCode hmac; | 1654 | struct GNUNET_MeshHash hmac; |
1653 | 1655 | ||
1654 | decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv); | 1656 | decrypted_size = t_decrypt (t, cbuf, &msg[1], payload_size, msg->iv); |
1655 | t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac); | 1657 | t_hmac (t, &msg[1], payload_size, msg->iv, GNUNET_NO, &hmac); |
1656 | if (0 != memcmp (&hmac, &msg->hmac, sizeof (struct GNUNET_HashCode))) | 1658 | if (0 != memcmp (&hmac, &msg->hmac, sizeof (hmac))) |
1657 | { | 1659 | { |
1658 | /* checksum failed */ | 1660 | /* checksum failed */ |
1659 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1661 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |