X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fsptps.c;h=2a298ffa70ace8b9431ae38d729d7f536df33e3b;hb=d917c8cb6b69475d568ccbe82389b9f2b3eb5e80;hp=3b9498c795122085857d68779185833b292e2ce2;hpb=47f33e07ff90b557cfa96999e921d35ea537ca80;p=tinc diff --git a/src/sptps.c b/src/sptps.c index 3b9498c7..2a298ffa 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -339,7 +339,6 @@ bool sptps_force_kex(sptps_t *s) { // Receive a handshake record. static bool receive_handshake(sptps_t *s, const char *data, uint16_t len) { // Only a few states to deal with handshaking. - fprintf(stderr, "Received handshake message, current state %d\n", s->state); switch(s->state) { case SPTPS_SECONDARY_KEX: // We receive a secondary KEX request, first respond by sending our own. @@ -509,7 +508,7 @@ bool sptps_receive_data(sptps_t *s, const char *data, size_t len) { s->buflen += toread; len -= toread; data += toread; - + // Exit early if we don't have the full length. if(s->buflen < 6) return true; @@ -628,18 +627,17 @@ bool sptps_start(sptps_t *s, void *handle, bool initiator, bool datagram, ecdsa_ // Stop a SPTPS session. bool sptps_stop(sptps_t *s) { // Clean up any resources. + cipher_close(&s->incipher); + cipher_close(&s->outcipher); + digest_close(&s->indigest); + digest_close(&s->outdigest); ecdh_free(&s->ecdh); free(s->inbuf); - s->inbuf = NULL; free(s->mykex); - s->mykex = NULL; free(s->hiskex); - s->hiskex = NULL; free(s->key); - s->key = NULL; free(s->label); - s->label = NULL; free(s->late); - s->late = NULL; + memset(s, 0, sizeof *s); return true; }