From 9bfdd77f722807a611d6910bbef45084360064a1 Mon Sep 17 00:00:00 2001 From: Yawning Angel Date: Tue, 13 May 2014 02:31:37 +0000 Subject: Add preliminary support for packet length obfuscation. The same algorithm as ScrambleSuit is used, except: * SipHash-2-4 in OFB mode is used to create the distribution. * The system CSPRNG is used when sampling the distribution. This fixes most of #3, all that remains is generating and sending a persistent distribution on the server side to the client. --- handshake_ntor.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'handshake_ntor.go') diff --git a/handshake_ntor.go b/handshake_ntor.go index ea9de71..84cd93c 100644 --- a/handshake_ntor.go +++ b/handshake_ntor.go @@ -363,13 +363,10 @@ func findMark(mark, buf []byte, startPos, maxPos int) int { return pos + startPos } -func makePad(min, max int64) ([]byte, error) { - padLen, err := randRange(min, max) - if err != nil { - return nil, err - } +func makePad(min, max int) ([]byte, error) { + padLen := randRange(min, max) pad := make([]byte, padLen) - _, err = rand.Read(pad) + _, err := rand.Read(pad) if err != nil { return nil, err } -- cgit v1.2.3