aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2015-06-17 09:29:10 +0000
committerBart Polot <bart@net.in.tum.de>2015-06-17 09:29:10 +0000
commit526b55bd2c30263cd4bc1f207aea52a309d749fb (patch)
tree61c733943cc5fd690a57026092c413b18cf9f081
parent484269bde6175eebaaa2faff0b044f1b8a8948da (diff)
downloadgnunet-526b55bd2c30263cd4bc1f207aea52a309d749fb.tar.gz
gnunet-526b55bd2c30263cd4bc1f207aea52a309d749fb.zip
- fix memleak
-rw-r--r--src/cadet/gnunet-service-cadet_tunnel.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/cadet/gnunet-service-cadet_tunnel.c b/src/cadet/gnunet-service-cadet_tunnel.c
index 5f0f660b4..c94e59e27 100644
--- a/src/cadet/gnunet-service-cadet_tunnel.c
+++ b/src/cadet/gnunet-service-cadet_tunnel.c
@@ -843,6 +843,19 @@ select_key (const struct CadetTunnel *t)
843 843
844 844
845/** 845/**
846 * Create a new Axolotl ephemeral (ratchet) key.
847 *
848 * @param t Tunnel.
849 */
850static void
851new_ephemeral (struct CadetTunnel *t)
852{
853 GNUNET_free_non_null (t->ax->DHRs);
854 t->ax->DHRs = GNUNET_CRYPTO_ecdhe_key_create();
855}
856
857
858/**
846 * Calculate HMAC. 859 * Calculate HMAC.
847 * 860 *
848 * @param plaintext Content to HMAC. 861 * @param plaintext Content to HMAC.
@@ -995,7 +1008,7 @@ t_ax_encrypt (struct CadetTunnel *t, void *dst, const void *src, size_t size)
995 struct GNUNET_HashCode hmac; 1008 struct GNUNET_HashCode hmac;
996 static const char ctx[] = "axolotl ratchet"; 1009 static const char ctx[] = "axolotl ratchet";
997 1010
998 ax->DHRs = GNUNET_CRYPTO_ecdhe_key_create (); 1011 new_ephemeral (t);
999 ax->HKs = ax->NHKs; 1012 ax->HKs = ax->NHKs;
1000 1013
1001 /* RK, NHKs, CKs = KDF( HMAC-HASH(RK, DH(DHRs, DHRr)) ) */ 1014 /* RK, NHKs, CKs = KDF( HMAC-HASH(RK, DH(DHRs, DHRr)) ) */
@@ -2654,19 +2667,6 @@ handle_ch_destroy (struct CadetTunnel *t,
2654 2667
2655 2668
2656/** 2669/**
2657 * Create a new Axolotl ephemeral (ratchet) key.
2658 *
2659 * @param t Tunnel.
2660 */
2661static void
2662new_ephemeral (struct CadetTunnel *t)
2663{
2664 GNUNET_free_non_null (t->ax->DHRs);
2665 t->ax->DHRs = GNUNET_CRYPTO_ecdhe_key_create();
2666}
2667
2668
2669/**
2670 * Free Axolotl data. 2670 * Free Axolotl data.
2671 * 2671 *
2672 * @param t Tunnel. 2672 * @param t Tunnel.