OLD | NEW |
1 # Authors: | 1 # Authors: |
2 # Trevor Perrin | 2 # Trevor Perrin |
3 # Google - added reqCAs parameter | 3 # Google - added reqCAs parameter |
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 # Martin von Loewis - python 3 port | 6 # Martin von Loewis - python 3 port |
7 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 | 7 # Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2 |
8 # | 8 # |
9 # See the LICENSE file for legal information regarding use of this file. | 9 # See the LICENSE file for legal information regarding use of this file. |
10 | 10 |
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 | 1563 |
1564 #Exchange ChangeCipherSpec and Finished messages | 1564 #Exchange ChangeCipherSpec and Finished messages |
1565 for result in self._sendFinished(session.masterSecret): | 1565 for result in self._sendFinished(session.masterSecret): |
1566 yield result | 1566 yield result |
1567 for result in self._getFinished(session.masterSecret): | 1567 for result in self._getFinished(session.masterSecret): |
1568 yield result | 1568 yield result |
1569 | 1569 |
1570 #Set the session | 1570 #Set the session |
1571 self.session = session | 1571 self.session = session |
1572 | 1572 |
| 1573 self.clientRandom = clientHello.random |
| 1574 self.serverRandom = serverHello.random |
1573 yield None # Handshake done! | 1575 yield None # Handshake done! |
1574 | 1576 |
1575 #Calculate the first cipher suite intersection. | 1577 #Calculate the first cipher suite intersection. |
1576 #This is the 'privileged' ciphersuite. We'll use it if we're | 1578 #This is the 'privileged' ciphersuite. We'll use it if we're |
1577 #doing a new negotiation. In fact, | 1579 #doing a new negotiation. In fact, |
1578 #the only time we won't use it is if we're resuming a | 1580 #the only time we won't use it is if we're resuming a |
1579 #session, in which case we use the ciphersuite from the session. | 1581 #session, in which case we use the ciphersuite from the session. |
1580 # | 1582 # |
1581 #Given the current ciphersuite ordering, this means we prefer SRP | 1583 #Given the current ciphersuite ordering, this means we prefer SRP |
1582 #over non-SRP. | 1584 #over non-SRP. |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2037 seed += bytearray(2) | 2039 seed += bytearray(2) |
2038 seed[len(seed) - 2] = len(context) >> 8 | 2040 seed[len(seed) - 2] = len(context) >> 8 |
2039 seed[len(seed) - 1] = len(context) & 0xFF | 2041 seed[len(seed) - 1] = len(context) & 0xFF |
2040 seed += context | 2042 seed += context |
2041 if self.version in ((3,1), (3,2)): | 2043 if self.version in ((3,1), (3,2)): |
2042 return PRF(self.session.masterSecret, label, seed, length) | 2044 return PRF(self.session.masterSecret, label, seed, length) |
2043 elif self.version == (3,3): | 2045 elif self.version == (3,3): |
2044 return PRF_1_2(self.session.masterSecret, label, seed, length) | 2046 return PRF_1_2(self.session.masterSecret, label, seed, length) |
2045 else: | 2047 else: |
2046 raise AssertionError() | 2048 raise AssertionError() |
OLD | NEW |