Skip to content

Commit

Permalink
sending supported groups in EE when HRR happens
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Sep 5, 2017
1 parent 2839f7f commit c7f4251
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tlslite/tlsconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1893,8 +1893,20 @@ def _serverTLS13Handshake(self, settings, clientHello, cipherSuite,

ee_extensions = []

# TODO add key_share if the key shares advertised by the client
# don't match our preferred ones
# a bit of a hack to detect if the HRR was sent
# as that means that original key share didn't match what we wanted
# send the client updated list of shares we support,
# preferred ones first
if clientHello.getExtension(ExtensionType.cookie):
ext = SupportedGroupsExtension()
groups = [getattr(GroupName, i) for i in settings.keyShares]
groups += [getattr(GroupName, i) for i in settings.eccCurves
if i not in groups]
groups += [getattr(GroupName, i) for i in settings.dhGroups
if i not in groups]
if groups:
ext.create(groups)
ee_extensions.append(ext)

encryptedExtensions = EncryptedExtensions().create(ee_extensions)
for result in self._sendMsg(encryptedExtensions):
Expand Down

0 comments on commit c7f4251

Please sign in to comment.