Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: third_party/tlslite/tlslite/messages.py

Issue 212883008: Add DHE_RSA support to tlslite. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update patch. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/handshakesettings.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/messages.py
diff --git a/third_party/tlslite/tlslite/messages.py b/third_party/tlslite/tlslite/messages.py
index 532d86bb13c9977834ec1f48e7dd33306339aa3e..550b387f947119e928fbcb120306db1e6f078029 100644
--- a/third_party/tlslite/tlslite/messages.py
+++ b/third_party/tlslite/tlslite/messages.py
@@ -533,31 +533,31 @@ class ServerKeyExchange(HandshakeMsg):
p.stopLengthCheck()
return self
- def write(self):
+ def write_params(self):
w = Writer()
if self.cipherSuite in CipherSuite.srpAllSuites:
w.addVarSeq(numberToByteArray(self.srp_N), 1, 2)
w.addVarSeq(numberToByteArray(self.srp_g), 1, 2)
w.addVarSeq(self.srp_s, 1, 1)
w.addVarSeq(numberToByteArray(self.srp_B), 1, 2)
- if self.cipherSuite in CipherSuite.srpCertSuites:
- w.addVarSeq(self.signature, 1, 2)
- elif self.cipherSuite in CipherSuite.anonSuites:
+ elif self.cipherSuite in CipherSuite.dhAllSuites:
w.addVarSeq(numberToByteArray(self.dh_p), 1, 2)
w.addVarSeq(numberToByteArray(self.dh_g), 1, 2)
w.addVarSeq(numberToByteArray(self.dh_Ys), 1, 2)
- if self.cipherSuite in []: # TODO support for signed_params
- w.addVarSeq(self.signature, 1, 2)
+ else:
+ assert(False)
+ return w.bytes
+
+ def write(self):
+ w = Writer()
+ w.bytes += self.write_params()
+ if self.cipherSuite in CipherSuite.certAllSuites:
+ w.addVarSeq(self.signature, 1, 2)
return self.postWrite(w)
def hash(self, clientRandom, serverRandom):
- oldCipherSuite = self.cipherSuite
- self.cipherSuite = None
- try:
- bytes = clientRandom + serverRandom + self.write()[4:]
- return MD5(bytes) + SHA1(bytes)
- finally:
- self.cipherSuite = oldCipherSuite
+ bytes = clientRandom + serverRandom + self.write_params()
+ return MD5(bytes) + SHA1(bytes)
class ServerHelloDone(HandshakeMsg):
def __init__(self):
@@ -607,7 +607,7 @@ class ClientKeyExchange(HandshakeMsg):
p.getFixBytes(len(p.bytes)-p.index)
else:
raise AssertionError()
- elif self.cipherSuite in CipherSuite.anonSuites:
+ elif self.cipherSuite in CipherSuite.dhAllSuites:
self.dh_Yc = bytesToNumber(p.getVarBytes(2))
else:
raise AssertionError()
« no previous file with comments | « third_party/tlslite/tlslite/handshakesettings.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698