From: Ivo Timmermans Date: Mon, 27 Mar 2000 22:59:16 +0000 (+0000) Subject: Upon regeneration, free the old encryption key `securely\' by overwriting it. X-Git-Tag: import-tinc-1.1~1027 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=98de35c742498878a27fb29becd3b7154525a60f;p=meshlink Upon regeneration, free the old encryption key `securely\' by overwriting it. --- diff --git a/src/encr.c b/src/encr.c index 899a46b0..e78ed5ec 100644 --- a/src/encr.c +++ b/src/encr.c @@ -300,15 +300,11 @@ void recalculate_encryption_keys(void) for(p = conn_list; p != NULL; p = p->next) { if(!p->public_key || !p->public_key->key) + /* We haven't received a key from this host (yet). */ continue; ek = make_shared_key(p->public_key->key); - if(!p->key) - { - p->key = xmalloc(sizeof(enc_key_t)); - p->key->key = NULL; - } - if(p->key->key) - free(p->key->key); + free_key(p->key); + p->key = xmalloc(sizeof(enc_key_t)); p->key->length = strlen(ek); p->key->expiry = p->public_key->expiry; p->key->key = xmalloc(strlen(ek) + 1);