summaryrefslogtreecommitdiff
path: root/handshake_ntor.go
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2014-05-13 02:31:37 +0000
committerYawning Angel <yawning@schwanenlied.me>2014-05-13 02:31:37 +0000
commit9bfdd77f722807a611d6910bbef45084360064a1 (patch)
tree1cbc9c840bad373368ada0f8322e29ea6b24adf8 /handshake_ntor.go
parent51a8dd5a86eeca744e0add680b1f4796c4babe2b (diff)
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.
Diffstat (limited to 'handshake_ntor.go')
-rw-r--r--handshake_ntor.go9
1 files changed, 3 insertions, 6 deletions
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
}