From: Vsevolod Stakhov Date: Sun, 2 Feb 2014 15:38:47 +0000 (+0000) Subject: Fix issue with random numbers generator in dns. X-Git-Tag: 0.6.8~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a38b7dc74cd77785440b4d2bcf2f7c7f199f3d72;p=thirdparty%2Frspamd.git Fix issue with random numbers generator in dns. --- diff --git a/src/dns.c b/src/dns.c index f8f4448931..70c22977dd 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));