[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [obfsproxy/master] Add and use const.MAX_HANDSHAKE_LENGTH.
commit cdb79019280e79b0f5080eeee43d14da48f746d4
Author: Philipp Winter <phw@xxxxxxxxxxxxxx>
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()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits