diff options
author | Yawning Angel <yawning@schwanenlied.me> | 2014-05-15 18:33:24 +0000 |
---|---|---|
committer | Yawning Angel <yawning@schwanenlied.me> | 2014-05-15 18:33:24 +0000 |
commit | f1b1dcdb106c00fef1acffe04caaeabb3a34239b (patch) | |
tree | f4f223382736b4332727590d910062ece7eae7c1 /packet.go | |
parent | b9e3aedfb1454fc314ae68f8075a8008e15fb20d (diff) |
Change hashDrbg to take a drbgSeed for initialization.
This paves the way for having servers use the same seed for all
incoming connections, across multiple startup/shutdown cycles. As
opposed to the current situation where each Obfs4Listener will
randomly generate it's seed at creation time.
Additionally, use 256 bit seeds (128 bit SipHash-2-4 key + 16 bytes of
initial material).
Diffstat (limited to 'packet.go')
-rw-r--r-- | packet.go | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -173,8 +173,13 @@ func (c *Obfs4Conn) consumeFramedPackets(w io.Writer) (n int, err error) { } case packetTypePrngSeed: // Only regenerate the distribution if we are the client. - if len(payload) >= distSeedLength && !c.isServer { - c.lenProbDist.reset(payload[:distSeedLength]) + if len(payload) >= drbgSeedLength && !c.isServer { + var seed *drbgSeed + seed, err = drbgSeedFromBytes(payload[:drbgSeedLength]) + if err != nil { + break + } + c.lenProbDist.reset(seed) } default: // Ignore unrecognised packet types. |