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

Side by Side Diff: third_party/tlslite/tlslite/messages.py

Issue 1299153002: Revert of Implement extended master secret in tlslite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « third_party/tlslite/tlslite/mathtls.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Authors: 1 # Authors:
2 # Trevor Perrin 2 # Trevor Perrin
3 # Google - handling CertificateRequest.certificate_types 3 # Google - handling CertificateRequest.certificate_types
4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support 4 # Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support
5 # Dimitris Moraitis - Anon ciphersuites 5 # Dimitris Moraitis - Anon ciphersuites
6 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 6 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
7 # 7 #
8 # See the LICENSE file for legal information regarding use of this file. 8 # See the LICENSE file for legal information regarding use of this file.
9 9
10 """Classes representing TLS messages.""" 10 """Classes representing TLS messages."""
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 self.random = bytearray(32) 107 self.random = bytearray(32)
108 self.session_id = bytearray(0) 108 self.session_id = bytearray(0)
109 self.cipher_suites = [] # a list of 16-bit values 109 self.cipher_suites = [] # a list of 16-bit values
110 self.certificate_types = [CertificateType.x509] 110 self.certificate_types = [CertificateType.x509]
111 self.compression_methods = [] # a list of 8-bit values 111 self.compression_methods = [] # a list of 8-bit values
112 self.srp_username = None # a string 112 self.srp_username = None # a string
113 self.tack = False 113 self.tack = False
114 self.supports_npn = False 114 self.supports_npn = False
115 self.server_name = bytearray(0) 115 self.server_name = bytearray(0)
116 self.channel_id = False 116 self.channel_id = False
117 self.extended_master_secret = False
118 self.support_signed_cert_timestamps = False 117 self.support_signed_cert_timestamps = False
119 self.status_request = False 118 self.status_request = False
120 119
121 def create(self, version, random, session_id, cipher_suites, 120 def create(self, version, random, session_id, cipher_suites,
122 certificate_types=None, srpUsername=None, 121 certificate_types=None, srpUsername=None,
123 tack=False, supports_npn=False, serverName=None): 122 tack=False, supports_npn=False, serverName=None):
124 self.client_version = version 123 self.client_version = version
125 self.random = random 124 self.random = random
126 self.session_id = session_id 125 self.session_id = session_id
127 self.cipher_suites = cipher_suites 126 self.cipher_suites = cipher_suites
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 while 1: 178 while 1:
180 if p2.atLengthCheck(): 179 if p2.atLengthCheck():
181 break # no host_name, oh well 180 break # no host_name, oh well
182 name_type = p2.get(1) 181 name_type = p2.get(1)
183 hostNameBytes = p2.getVarBytes(2) 182 hostNameBytes = p2.getVarBytes(2)
184 if name_type == NameType.host_name: 183 if name_type == NameType.host_name:
185 self.server_name = hostNameBytes 184 self.server_name = hostNameBytes
186 break 185 break
187 elif extType == ExtensionType.channel_id: 186 elif extType == ExtensionType.channel_id:
188 self.channel_id = True 187 self.channel_id = True
189 elif extType == ExtensionType.extended_master_secret:
190 self.extended_master_secret = True
191 elif extType == ExtensionType.signed_cert_timestamps: 188 elif extType == ExtensionType.signed_cert_timestamps:
192 if extLength: 189 if extLength:
193 raise SyntaxError() 190 raise SyntaxError()
194 self.support_signed_cert_timestamps = True 191 self.support_signed_cert_timestamps = True
195 elif extType == ExtensionType.status_request: 192 elif extType == ExtensionType.status_request:
196 # Extension contents are currently ignored. 193 # Extension contents are currently ignored.
197 # According to RFC 6066, this is not strictly forbidden 194 # According to RFC 6066, this is not strictly forbidden
198 # (although it is suboptimal): 195 # (although it is suboptimal):
199 # Servers that receive a client hello containing the 196 # Servers that receive a client hello containing the
200 # "status_request" extension MAY return a suitable 197 # "status_request" extension MAY return a suitable
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 self.server_version = (0,0) 260 self.server_version = (0,0)
264 self.random = bytearray(32) 261 self.random = bytearray(32)
265 self.session_id = bytearray(0) 262 self.session_id = bytearray(0)
266 self.cipher_suite = 0 263 self.cipher_suite = 0
267 self.certificate_type = CertificateType.x509 264 self.certificate_type = CertificateType.x509
268 self.compression_method = 0 265 self.compression_method = 0
269 self.tackExt = None 266 self.tackExt = None
270 self.next_protos_advertised = None 267 self.next_protos_advertised = None
271 self.next_protos = None 268 self.next_protos = None
272 self.channel_id = False 269 self.channel_id = False
273 self.extended_master_secret = False
274 self.signed_cert_timestamps = None 270 self.signed_cert_timestamps = None
275 self.status_request = False 271 self.status_request = False
276 272
277 def create(self, version, random, session_id, cipher_suite, 273 def create(self, version, random, session_id, cipher_suite,
278 certificate_type, tackExt, next_protos_advertised): 274 certificate_type, tackExt, next_protos_advertised):
279 self.server_version = version 275 self.server_version = version
280 self.random = random 276 self.random = random
281 self.session_id = session_id 277 self.session_id = session_id
282 self.cipher_suite = cipher_suite 278 self.cipher_suite = cipher_suite
283 self.certificate_type = certificate_type 279 self.certificate_type = certificate_type
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 w2.add(len(b), 2) 351 w2.add(len(b), 2)
356 w2.bytes += b 352 w2.bytes += b
357 if self.next_protos_advertised is not None: 353 if self.next_protos_advertised is not None:
358 encoded_next_protos_advertised = self.__next_protos_encoded() 354 encoded_next_protos_advertised = self.__next_protos_encoded()
359 w2.add(ExtensionType.supports_npn, 2) 355 w2.add(ExtensionType.supports_npn, 2)
360 w2.add(len(encoded_next_protos_advertised), 2) 356 w2.add(len(encoded_next_protos_advertised), 2)
361 w2.addFixSeq(encoded_next_protos_advertised, 1) 357 w2.addFixSeq(encoded_next_protos_advertised, 1)
362 if self.channel_id: 358 if self.channel_id:
363 w2.add(ExtensionType.channel_id, 2) 359 w2.add(ExtensionType.channel_id, 2)
364 w2.add(0, 2) 360 w2.add(0, 2)
365 if self.extended_master_secret:
366 w2.add(ExtensionType.extended_master_secret, 2)
367 w2.add(0, 2)
368 if self.signed_cert_timestamps: 361 if self.signed_cert_timestamps:
369 w2.add(ExtensionType.signed_cert_timestamps, 2) 362 w2.add(ExtensionType.signed_cert_timestamps, 2)
370 w2.addVarSeq(bytearray(self.signed_cert_timestamps), 1, 2) 363 w2.addVarSeq(bytearray(self.signed_cert_timestamps), 1, 2)
371 if self.status_request: 364 if self.status_request:
372 w2.add(ExtensionType.status_request, 2) 365 w2.add(ExtensionType.status_request, 2)
373 w2.add(0, 2) 366 w2.add(0, 2)
374 if len(w2.bytes): 367 if len(w2.bytes):
375 w.add(len(w2.bytes), 2) 368 w.add(len(w2.bytes), 2)
376 w.bytes += w2.bytes 369 w.bytes += w2.bytes
377 return self.postWrite(w) 370 return self.postWrite(w)
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 newMsg = ApplicationData().create(self.bytes[:1]) 796 newMsg = ApplicationData().create(self.bytes[:1])
804 self.bytes = self.bytes[1:] 797 self.bytes = self.bytes[1:]
805 return newMsg 798 return newMsg
806 799
807 def parse(self, p): 800 def parse(self, p):
808 self.bytes = p.bytes 801 self.bytes = p.bytes
809 return self 802 return self
810 803
811 def write(self): 804 def write(self):
812 return self.bytes 805 return self.bytes
OLDNEW
« no previous file with comments | « third_party/tlslite/tlslite/mathtls.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698