From 9fe9959c76c96ec3284f43c692cbb099230dcb73 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Wed, 28 May 2014 04:22:36 +0000 Subject: Change the weighted distribution algorithm be uniform. The old way was biasted towards the earlier values. Thanks to asn for pointing this out and suggesting an alternative. As an additional tweak, do not reuse the drbg seed when calculating the IAT distribution, but instead run the seed through SHA256 first, for extra tinfoil goodness. --- packet.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'packet.go') diff --git a/packet.go b/packet.go index 78f6697..61ed981 100644 --- a/packet.go +++ b/packet.go @@ -28,6 +28,7 @@ package obfs4 import ( + "crypto/sha256" "encoding/binary" "fmt" "io" @@ -182,7 +183,12 @@ func (c *Obfs4Conn) consumeFramedPackets(w io.Writer) (n int, err error) { } c.lenProbDist.reset(seed) if c.iatProbDist != nil { - c.iatProbDist.reset(seed) + iatSeedSrc := sha256.Sum256(seed.Bytes()[:]) + iatSeed, err := DrbgSeedFromBytes(iatSeedSrc[:]) + if err != nil { + break + } + c.iatProbDist.reset(iatSeed) } } default: -- cgit v1.2.3