From: Guus Sliepen Date: Sat, 11 May 2013 12:13:23 +0000 (+0200) Subject: Don't free ephemeral ECDH keys twice. X-Git-Tag: release-1.1pre8~48 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=d03dc91e27b31851f87351c03cfc9a43c1b06458 Don't free ephemeral ECDH keys twice. ecdh_compute_shared() was changed to immediately delete the ephemeral key after the shared secret was computed. Therefore, the pointer to the ecdh_t struct should be zeroed so it won't be freed again when a struct sptps_t is freed. --- diff --git a/src/sptps.c b/src/sptps.c index 5d0d4562..03a1e9aa 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -319,6 +319,7 @@ static bool receive_sig(sptps_t *s, const char *data, uint16_t len) { char shared[ECDH_SHARED_SIZE]; if(!ecdh_compute_shared(s->ecdh, s->hiskex + 1 + 32, shared)) return false; + s->ecdh = NULL; // Generate key material from shared secret. if(!generate_key_material(s, shared, sizeof shared))