Skip to content

Commit 5a25a97

Browse files
authored
Merge pull request #390 from tomato42/obsolete-curves
check if client doesn't advertise in TLS 1.3 groups forbidden in TLS 1.3
2 parents 3aa55f4 + 24f59a0 commit 5a25a97

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tlslite/constants.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,13 @@ def toRepr(cls, value, blacklist=None):
357357
return super(GroupName, cls).toRepr(value, blacklist)
358358

359359

360+
# groups forbidden by RFC 8446 section B.3.1.4
361+
TLS_1_3_FORBIDDEN_GROUPS = frozenset().union(
362+
range(1, 0x17),
363+
range(0x1A, 0x1D),
364+
(0xff01, 0xff02))
365+
366+
360367
class ECPointFormat(TLSEnum):
361368
"""Names and ID's of supported EC point formats."""
362369

tlslite/tlsconnection.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3115,6 +3115,14 @@ def _serverGetClientHello(self, settings, private_key, cert_chain,
31153115
"Empty key_share extension"):
31163116
yield result
31173117

3118+
# check supported_groups
3119+
if TLS_1_3_FORBIDDEN_GROUPS.intersection(sup_groups.groups):
3120+
for result in self._sendError(
3121+
AlertDescription.illegal_parameter,
3122+
"Client advertised in TLS 1.3 Client Hello a key "
3123+
"exchange group forbidden in TLS 1.3"):
3124+
yield result
3125+
31183126
# Check key_share
31193127
mismatch = next((i for i in key_share.client_shares
31203128
if i.group not in sup_groups.groups), None)

0 commit comments

Comments
 (0)