]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix issue with random numbers generator in dns.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 2 Feb 2014 15:38:47 +0000 (15:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 2 Feb 2014 15:38:47 +0000 (15:38 +0000)
src/dns.c

index ce2467da4069ebccf50b4935b1721aee8f6d7c22..375ec9811082b82ca666877112cff3b48fd9dacb 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -48,11 +48,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));