From a38b7dc74cd77785440b4d2bcf2f7c7f199f3d72 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 2 Feb 2014 15:38:47 +0000 Subject: [PATCH] Fix issue with random numbers generator in dns. --- src/dns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dns.c b/src/dns.c index f8f444893..70c22977d 100644 --- a/src/dns.c +++ b/src/dns.c @@ -75,11 +75,11 @@ static void dns_permutor_init (struct dns_permutor *p) { /* Init random key and IV */ - rspamd_random_bytes (p->perm_buf, sizeof (p->perm_buf)); + rspamd_random_bytes (p->perm_buf, PERMUTOR_KSIZE + PERMUTOR_IVSIZE); /* Setup ctx */ chacha_keysetup (&p->ctx, p->perm_buf, PERMUTOR_KSIZE * 8, 0); - chacha_ivsetup (&p->ctx, p->perm_buf + PERMUTOR_KSIZE); + chacha_ivsetup (&p->ctx, p->perm_buf + PERMUTOR_KSIZE * 8); chacha_encrypt_bytes (&p->ctx, p->perm_buf, p->perm_buf, sizeof (p->perm_buf)); -- 2.39.5