aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-02-02 15:38:47 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-02-03 09:08:14 +0000
commita38b7dc74cd77785440b4d2bcf2f7c7f199f3d72 (patch)
treed87db89a650ab9e9018488058d38a0c5a10cd312
parent25c0e4bf48541f853d00ddba421718a67c710739 (diff)
downloadrspamd-a38b7dc74cd77785440b4d2bcf2f7c7f199f3d72.tar.gz
rspamd-a38b7dc74cd77785440b4d2bcf2f7c7f199f3d72.zip
Fix issue with random numbers generator in dns.
-rw-r--r--src/dns.c4
1 files 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));