Use crypto_rand() everywhere

This commit is contained in:
Frank Denis 2023-02-24 16:20:39 +01:00
parent 24a301b1af
commit 03c6f92a5f
2 changed files with 2 additions and 3 deletions

View File

@ -5,7 +5,6 @@ import (
crypto_rand "crypto/rand" crypto_rand "crypto/rand"
"crypto/sha512" "crypto/sha512"
"errors" "errors"
"math/rand"
"github.com/jedisct1/dlog" "github.com/jedisct1/dlog"
"github.com/jedisct1/xsecretbox" "github.com/jedisct1/xsecretbox"
@ -102,7 +101,7 @@ func (proxy *Proxy) Encrypt(
minQuestionSize = Max(proxy.questionSizeEstimator.MinQuestionSize(), minQuestionSize) minQuestionSize = Max(proxy.questionSizeEstimator.MinQuestionSize(), minQuestionSize)
} else { } else {
var xpad [1]byte var xpad [1]byte
rand.Read(xpad[:]) crypto_rand.Read(xpad[:])
minQuestionSize += int(xpad[0]) minQuestionSize += int(xpad[0])
} }
paddedLength := Min(MaxDNSUDPPacketSize, (Max(minQuestionSize, QueryOverhead)+1+63) & ^63) paddedLength := Min(MaxDNSUDPPacketSize, (Max(minQuestionSize, QueryOverhead)+1+63) & ^63)

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/dnscrypt/dnscrypt-proxy module github.com/dnscrypt/dnscrypt-proxy
go 1.19 go 1.20
require ( require (
github.com/BurntSushi/toml v1.2.1 github.com/BurntSushi/toml v1.2.1