Skip to content

Commit

Permalink
Merge 24f59a0 into 3aa55f4
Browse files Browse the repository at this point in the history
  • Loading branch information
tomato42 committed Jan 16, 2020
2 parents 3aa55f4 + 24f59a0 commit d5fd75a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tlslite/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,13 @@ def toRepr(cls, value, blacklist=None):
return super(GroupName, cls).toRepr(value, blacklist)


# groups forbidden by RFC 8446 section B.3.1.4
TLS_1_3_FORBIDDEN_GROUPS = frozenset().union(
range(1, 0x17),
range(0x1A, 0x1D),
(0xff01, 0xff02))


class ECPointFormat(TLSEnum):
"""Names and ID's of supported EC point formats."""

Expand Down
8 changes: 8 additions & 0 deletions tlslite/tlsconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3115,6 +3115,14 @@ def _serverGetClientHello(self, settings, private_key, cert_chain,
"Empty key_share extension"):
yield result

# check supported_groups
if TLS_1_3_FORBIDDEN_GROUPS.intersection(sup_groups.groups):
for result in self._sendError(
AlertDescription.illegal_parameter,
"Client advertised in TLS 1.3 Client Hello a key "
"exchange group forbidden in TLS 1.3"):
yield result

# Check key_share
mismatch = next((i for i in key_share.client_shares
if i.group not in sup_groups.groups), None)
Expand Down

0 comments on commit d5fd75a

Please sign in to comment.