Set initial previous peer nonce to zero

This commit is contained in:
Frank Denis 2015-11-04 01:10:27 +01:00
parent 1e1e0d7c13
commit 158c766368
1 changed files with 1 additions and 0 deletions

View File

@ -72,6 +72,7 @@ alloc_encrypt(struct vtun_host *host)
if (init_nonce(ctx.nonce, crypto_aead_NPUBBYTES) != 0) { if (init_nonce(ctx.nonce, crypto_aead_NPUBBYTES) != 0) {
return -1; return -1;
} }
memset(ctx.previous_decrypted_nonce, 0, crypto_aead_NPUBBYTES);
crypto_aead_aes256gcm_beforenm(ctx.state, host->key); crypto_aead_aes256gcm_beforenm(ctx.state, host->key);
sodium_free(host->key); sodium_free(host->key);
host->key = NULL; host->key = NULL;