Upon regeneration, free the old encryption key `securely\' by overwriting it.

This commit is contained in:
Ivo Timmermans 2000-03-27 22:59:16 +00:00
parent b50523dc44
commit 98de35c742

View 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);