Skip to content

Commit 5aa5a14

Browse files
committed
verify that client advertised shares are RFC compliant
RFC 8446, section 4.2.8
1 parent 56a5a20 commit 5aa5a14

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tlslite/tlsconnection.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,6 +3127,23 @@ def _serverGetClientHello(self, settings, private_key, cert_chain,
31273127
.format(GroupName.toStr(mismatch))):
31283128
yield result
31293129

3130+
key_share_ids = [i.group for i in key_share.client_shares]
3131+
if len(set(key_share_ids)) != len(key_share_ids):
3132+
for result in self._sendError(
3133+
AlertDescription.illegal_parameter,
3134+
"Client sent multiple key shares for the same "
3135+
"group"):
3136+
yield result
3137+
3138+
group_ids = sup_groups.groups
3139+
diff = set(group_ids) - set(key_share_ids)
3140+
if key_share_ids != [i for i in group_ids if i not in diff]:
3141+
for result in self._sendError(
3142+
AlertDescription.illegal_parameter,
3143+
"Client sent key shares in different order than "
3144+
"the advertised groups."):
3145+
yield result
3146+
31303147
sig_algs = clientHello.getExtension(
31313148
ExtensionType.signature_algorithms)
31323149
if (not psk_modes or not psk) and sig_algs:

0 commit comments

Comments
 (0)