]> git.meshlink.io Git - meshlink/commitdiff
Upon regeneration, free the old encryption key `securely\' by overwriting it.
authorIvo Timmermans <ivo@lychnis.net>
Mon, 27 Mar 2000 22:59:16 +0000 (22:59 +0000)
committerIvo Timmermans <ivo@lychnis.net>
Mon, 27 Mar 2000 22:59:16 +0000 (22:59 +0000)
src/encr.c

index 899a46b0718bb8dad51bc94a04123aa0e000204c..e78ed5ec62a859e04f432e2bb728c04f2f12ac6e 100644 (file)
@@ -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);