[Pkg-privacy-commits] [obfsproxy] 311/353: Add and use const.MAX_HANDSHAKE_LENGTH.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:02:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit cdb79019280e79b0f5080eeee43d14da48f746d4
Author: Philipp Winter <phw at torproject.org>
Date:   Mon Mar 3 23:53:14 2014 +0100

    Add and use const.MAX_HANDSHAKE_LENGTH.
---
 obfsproxy/transports/scramblesuit/const.py | 6 ++++++
 obfsproxy/transports/scramblesuit/state.py | 7 ++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/obfsproxy/transports/scramblesuit/const.py b/obfsproxy/transports/scramblesuit/const.py
index ca6f8ea..ca3ec4d 100644
--- a/obfsproxy/transports/scramblesuit/const.py
+++ b/obfsproxy/transports/scramblesuit/const.py
@@ -55,6 +55,12 @@ MAX_PACKET_DELAY = 0.01
 # The maximum amount of padding to be appended to handshake data.
 MAX_PADDING_LENGTH = 1500
 
+# The maximum length of a handshake in bytes (UniformDH as well as session
+# tickets).
+MAX_HANDSHAKE_LENGTH = MAX_PADDING_LENGTH + \
+                       MARK_LENGTH + \
+                       HMAC_SHA256_128_LENGTH
+
 # Length of ScrambleSuit's MTU in bytes.  Note that this is *not* the link MTU
 # which is probably 1500.
 MTU = 1448
diff --git a/obfsproxy/transports/scramblesuit/state.py b/obfsproxy/transports/scramblesuit/state.py
index 384db97..f015755 100644
--- a/obfsproxy/transports/scramblesuit/state.py
+++ b/obfsproxy/transports/scramblesuit/state.py
@@ -115,11 +115,8 @@ class State( object ):
 
         # Unauthenticated connections are closed after having received the
         # following amount of bytes.
-        max_handshake_len = const.MAX_PADDING_LENGTH + \
-                            const.MARK_LENGTH + \
-                            const.HMAC_SHA256_128_LENGTH
-        self.closingThreshold = prng.randint(max_handshake_len,
-                                             max_handshake_len * 2)
+        self.closingThreshold = prng.randint(const.MAX_HANDSHAKE_LENGTH,
+                                             const.MAX_HANDSHAKE_LENGTH * 2)
 
         self.writeState()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list